[Libguestfs] [PATCH] mke2fs: Use e4fsprogs programs if available.

Jim Meyering jim at meyering.net
Wed Aug 19 13:35:49 UTC 2009


...
> +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 };




More information about the Libguestfs mailing list