On Sun, Aug 19, 2018 at 2:38 PM Richard W.M. Jones <rjones@redhat.com> wrote:
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.

I agree, I tried to keep the current style of the module.
 

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