diff options
author | P J P <pj.pandit@yahoo.co.in> | 2010-09-14 12:08:37 +0530 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-10-12 22:35:05 -0700 |
commit | 648a240b7b69ff5f6c217c29ed46ccac5e9ad4c2 (patch) | |
tree | 668cb811947dc16ffebf6818873238832a8ad8ac /utils | |
parent | 904fea3db31bda2360a9d3b6fe1cd0ce17c9c0ee (diff) | |
download | syslinux-648a240b7b69ff5f6c217c29ed46ccac5e9ad4c2.tar.gz syslinux-648a240b7b69ff5f6c217c29ed46ccac5e9ad4c2.tar.xz syslinux-648a240b7b69ff5f6c217c29ed46ccac5e9ad4c2.zip |
isohybrid: Use ftruncate instead of seek for final padding
Pad the image via ftruncate instead of seeking to the end (which was
done incorrectly).
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/isohybrid.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/utils/isohybrid.c b/utils/isohybrid.c index 57c1015e..7ee9a7f0 100644 --- a/utils/isohybrid.c +++ b/utils/isohybrid.c @@ -543,15 +543,11 @@ main(int argc, char *argv[]) if (padding) { - if (!(buf = realloc(buf, padding))) - err(1, "%s: could not re-size buffer", argv[0]); + if (fsync(fileno(fp))) + err(1, "%s: could not synchronise", argv[0]); - if (fseek(fp, isostat.st_size, SEEK_SET)) - err(1, "%s: seek error - 6", argv[0]); - - memset(buf, 0, padding); - if (fwrite(buf, sizeof(char), padding, fp) != (size_t)padding) - err(1, "%s: write error - 2", argv[0]); + if (ftruncate(fileno(fp), isostat.st_size + padding)) + err(1, "%s: could not add padding bytes", argv[0]); } free(buf); |