[Libguestfs] [PATCH v3 1/4] file: Avoid unsupported fallocate() calls

Richard W.M. Jones rjones at redhat.com
Sun Aug 19 11:38:02 UTC 2018


On Sun, Aug 19, 2018 at 01:13:05AM +0300, Nir Soffer wrote:
> -    if (r == -1 && errno != EOPNOTSUPP) {
> +    if (r == 0)
> +      return r;
> +
> +    if (errno != EOPNOTSUPP) {
>        nbdkit_error ("zero: %m");
> +      return r;

I think these cases where we "return r" are rather awkward
(there are more of them in this commit).

I think we should return 0 or return -1 as appropriate.  It seems
clearer to me and has less risk of going wrong in future
if we rearrange the code.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list