Mercurial > hg > toybox
comparison lib/lib.c @ 1141:37cbbbe547a3 draft
Doing math on void pointers isn't portable, reported by Nathan McSween.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 08 Dec 2013 13:26:05 -0600 |
parents | f9678ea553c8 |
children | 80c9df5145fe |
comparison
equal
deleted
inserted
replaced
1140:ef0bf6560071 | 1141:37cbbbe547a3 |
---|---|
65 ssize_t readall(int fd, void *buf, size_t len) | 65 ssize_t readall(int fd, void *buf, size_t len) |
66 { | 66 { |
67 size_t count = 0; | 67 size_t count = 0; |
68 | 68 |
69 while (count<len) { | 69 while (count<len) { |
70 int i = read(fd, buf+count, len-count); | 70 int i = read(fd, (char *)buf+count, len-count); |
71 if (!i) break; | 71 if (!i) break; |
72 if (i<0) return i; | 72 if (i<0) return i; |
73 count += i; | 73 count += i; |
74 } | 74 } |
75 | 75 |