[PATCH] mke2fs: Use e4fsprogs programs if available.
-- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
...
+static const char * +get_mke2fs (void) +{ + static const char *progs[] = { "/sbin/mke4fs", "/sbin/mke2fs", NULL }; + int i; + + for (i = 0; progs[i]; ++i) + if (access (progs[i], F_OK) == 0) + return progs[i]; + + reply_with_error ("mke2fs: no mke2fs binary found in appliance"); + return NULL; ...
All looks good One nit: you can add one more "const" there, since it's a const list of const strings: static const char *const progs[] = { "/sbin/mke4fs", "/sbin/mke2fs", NULL };
participants (2)
-
Jim Meyering -
Richard W.M. Jones