plug a few coverity-spotted leaks
[gitweb.git] / wrapper.c
index 28290002b9f6434d716a39612f3afc9958c292af..85f09df747637b94e0488ad65984c3f97c732034 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -148,8 +148,10 @@ ssize_t read_in_full(int fd, void *buf, size_t count)
 
        while (count > 0) {
                ssize_t loaded = xread(fd, p, count);
-               if (loaded <= 0)
-                       return total ? total : loaded;
+               if (loaded < 0)
+                       return -1;
+               if (loaded == 0)
+                       return total;
                count -= loaded;
                p += loaded;
                total += loaded;