getgroups(): clarify code
authorNikolaus Rath <Nikolaus@rath.org>
Mon, 5 Jun 2017 11:27:31 +0000 (07:27 -0400)
committerNikolaus Rath <Nikolaus@rath.org>
Mon, 5 Jun 2017 11:27:31 +0000 (07:27 -0400)
read() return value should always be positive or -1. However,
since we cast to unsigned a little later, it's clearer
to check for non-negativity.

lib/fuse_lowlevel.c

index c3724a639b995e9e92ae4669b3b0726f7c65130b..c1c573fa2f83a6f22a8dc371515d0df5a37493ca 100644 (file)
@@ -2935,7 +2935,7 @@ retry:
 
        ret = read(fd, buf, bufsize);
        close(fd);
-       if (ret == -1) {
+       if (ret < 0) {
                ret = -EIO;
                goto out_free;
        }