Displaying 3 results from an estimated 3 matches for "makefsxxxxxx".
2014 Jul 28
5
[PATCH] make-fs: respect libguestfs' temporary dir
...s/make-fs.c
+++ b/make-fs/make-fs.c
@@ -381,8 +381,9 @@ estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
CLEANUP_FCLOSE FILE *fp = NULL;
char line[256];
size_t len;
+ CLEANUP_FREE char *tmpdir = guestfs_get_tmpdir (g);
- if (asprintf (&tmpfile, "/tmp/makefsXXXXXX") == -1) {
+ if (asprintf (&tmpfile, "%s/makefsXXXXXX", tmpdir) == -1) {
perror ("asprintf");
return -1;
}
--
1.9.3
2014 Jan 27
0
[PATCH INCOMPLETE] Rewrite virt-make-fs in C (originally Perl).
...that is complex given partitions.
+ */
+static int
+estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
+{
+ struct stat statbuf;
+ const char *argv[6];
+ CLEANUP_UNLINK_FREE char *tmpfile = NULL;
+ FILE *fp;
+ char line[256];
+
+ if (asprintf (&tmpfile, "/tmp/makefsXXXXXX") == -1) {
+ perror ("asprintf");
+ return -1;
+ }
+ if (mkstemp (tmpfile) == -1) {
+ perror (tmpfile);
+ return -1;
+ }
+
+ if (stat (input, &statbuf) == -1) {
+ perror (input);
+ return -1;
+ }
+ if (S_ISDIR (statbuf.st_mode)) {
+ *ifmt = strdup (&quo...
2014 Jan 27
2
[PATCH INCOMPLETE] Rewrite virt-make-fs in C (originally Perl).
I thought it would be easy to rewrite virt-make-fs in C.
Two days later ...
The Perl program uses a lot of external commands, which makes
it pretty tedious to implement in C.
Rich.