[syslinux] isohybrid: seek error - 6: Invalid argument
P J P
pj.pandit at yahoo.co.in
Mon Sep 13 02:10:12 PDT 2010
Hi,
Bellow is a patch to replace fseek-memset-fwrite padding sequence with a more clean and simple truncate(3) call.
===
diff --git a/utils/isohybrid.c b/utils/isohybrid.c
index 57c1015..fbff06f 100644
--- a/utils/isohybrid.c
+++ b/utils/isohybrid.c
@@ -541,21 +541,11 @@ main(int argc, char *argv[])
if (fwrite(buf, sizeof(char), i, fp) != (size_t)i)
err(1, "%s: write error - 1", argv[0]);
- if (padding)
- {
- if (!(buf = realloc(buf, padding)))
- err(1, "%s: could not re-size buffer", 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]);
- }
-
free(buf);
fclose(fp);
+ if (padding && truncate(argv[0], padding))
+ err(1, "%s: could not add padding bytes", argv[0]);
+
===
Thank you.
---
Regards
-Prasad
PS: Please don't send me html/attachment/Fwd mails
More information about the Syslinux
mailing list