[syslinux] [PATCH 02/05] utils/mkdiskimage.in: With option -s: Avoid zeroizing the partition even if truncate() failed
Thomas Schmitt
scdbackup at gmx.net
Thu Jan 30 12:59:23 PST 2014
utils/mkdiskimage.in: With option -s: Avoid zeroizing the partition even if truncate() failed.
--- utils/mkdiskimage_patched_01.in 2014-01-30 20:43:02.000000000 +0100
+++ utils/mkdiskimage.in 2014-01-30 20:45:09.000000000 +0100
@@ -217,8 +217,11 @@ print OUTPUT "\x55\xaa";
$totalsize = $c*$h*$s;
$tracks = $c*$h;
-# If -s is given, try to simply use truncate...
-unless ($opt{'s'} && truncate(OUTPUT, $totalsize * 512)) {
+# If -s is given, simply use truncate. Do not care for success. Failure is
+# normal with Linux block devices.
+if ($opt{'s'}) {
+ truncate(OUTPUT, $totalsize * 512);
+} else {
$track = "\0" x (512*$s);
# Print fractional track
More information about the Syslinux
mailing list