Fix CID 1215124: Handle errors properly.

This commit is contained in:
Marcel Moolenaar 2014-05-21 17:38:14 +00:00
parent a513818762
commit 645c72194e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266512

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);
}