Next fix in safe_read

This commit is contained in:
Jaroslav Kysela 2000-08-29 08:04:19 +00:00
parent 76702105ec
commit 9d3cbc3833

View file

@ -589,7 +589,8 @@ ssize_t safe_read(int fd, void *buf, size_t count)
ssize_t result = 0, res; ssize_t result = 0, res;
while (count > 0) { while (count > 0) {
res = read(fd, buf, count); if ((res = read(fd, buf, count)) == 0)
break;
if (res < 0) if (res < 0)
return result > 0 ? result : res; return result > 0 ? result : res;
count -= res; count -= res;