Browse Source

client: fix bug in write_all function

In an error condition, the count parameter would be returned instead of
the number of bytes written. Discovered by static analysis.
Davin McCall 6 months ago
parent
commit
96a0538a1e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/includes/dinit-client.h

+ 1 - 1
src/includes/dinit-client.h

@@ -214,7 +214,7 @@ inline int write_all(int fd, const void *buf, int count)
         int r = write(fd, cbuf, count);
         if (r == -1) {
             if (errno == EINTR) continue;
-            return (count > 0) ? count : r;
+            return (w > 0) ? w : r;
         }
         w += r;
         cbuf += r;