Check a return code from read(2) correctly.

PR:		kern/70815
Submitted by:	info [at] haakh.de
This commit is contained in:
Maxim Konovalov 2004-08-22 08:56:01 +00:00
parent 386c57b571
commit 022c9a28ee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134150

View File

@ -73,7 +73,7 @@ filedup(const char *path, int flags)
/* Read everything until we know how big it is */
for (;;) {
result = read(fd, buf, LOAD_TINYBUF);
if (size == -1) {
if (result == -1) {
free(buf, LOAD_TINYBUF);
close(fd);
return(NULL);