[Libguestfs] [PATCH V2] NEW API: add a new api restorecon

Richard W.M. Jones rjones at redhat.com
Wed Oct 24 10:29:07 UTC 2012


On Wed, Oct 24, 2012 at 06:01:28PM +0800, Wanlong Gao wrote:
[...]

Just noticed one more thing ...

> +int
> +do_restorecon (const char *pathname,
> +               const char *labelprefix,
> +               int recursion,
> +               int force)
> +{
> +  int r;
> +  size_t i = 0;
> +  char *buf;
> +  char *err;
> +  const char *argv[MAX_ARGS];
> +
> +  buf = sysroot_path (pathname);
> +  if (!buf) {
> +    reply_with_error ("malloc");
> +    return -1;
> +  }
> +
> +  ADD_ARG (argv, i, str_restorecon);
> +
> +  if (optargs_bitmask & GUESTFS_RESTORECON_LABELPREFIX_BITMASK) {
> +    if (labelprefix) {

The second if-statement here isn't needed.  OString arguments can
never be NULL, *if* the corresponding bitmask bit is set.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list