Fix CID 1215124: Handle errors properly.

This commit is contained in:
marcel 2014-05-21 17:38:14 +00:00
parent f845ed2375
commit b67182258c

View File

@ -119,8 +119,12 @@ image_copyout(int fd)
}
}
free(buffer);
if (error)
return (error);
ofs = lseek(fd, 0L, SEEK_CUR);
ftruncate(fd, ofs);
if (ofs == -1)
return (errno);
error = (ftruncate(fd, ofs) == -1) ? errno : 0;
return (error);
}