Mercurial > hg > toybox
comparison lib/lib.c @ 1202:4f080cdb2f6e draft
Various cleanups found by Tom Sparrow's static analysis.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 16 Feb 2014 11:09:23 -0600 |
parents | 80c9df5145fe |
children | 86745958cea9 |
comparison
equal
deleted
inserted
replaced
1201:9adf66c7dd4e | 1202:4f080cdb2f6e |
---|---|
79 // Keep writing until done or EOF | 79 // Keep writing until done or EOF |
80 ssize_t writeall(int fd, void *buf, size_t len) | 80 ssize_t writeall(int fd, void *buf, size_t len) |
81 { | 81 { |
82 size_t count = 0; | 82 size_t count = 0; |
83 while (count<len) { | 83 while (count<len) { |
84 int i = write(fd, buf+count, len-count); | 84 int i = write(fd, count+(char *)buf, len-count); |
85 if (i<1) return i; | 85 if (i<1) return i; |
86 count += i; | 86 count += i; |
87 } | 87 } |
88 | 88 |
89 return count; | 89 return count; |