[Glibc-bsd-commits] r5440 - in trunk/ufsutils/debian: . patches

rmh at alioth.debian.org rmh at alioth.debian.org
Sat Feb 22 13:02:49 UTC 2014


Author: rmh
Date: 2014-02-22 13:02:49 +0000 (Sat, 22 Feb 2014)
New Revision: 5440

Modified:
   trunk/ufsutils/debian/changelog
   trunk/ufsutils/debian/patches/05_wipe_otherfs.patch
Log:
05_wipe_otherfs.patch: Handle DIOCGMEDIASIZE failure gracefully. (Closes: #737580)

Modified: trunk/ufsutils/debian/changelog
===================================================================
--- trunk/ufsutils/debian/changelog	2014-02-21 22:58:06 UTC (rev 5439)
+++ trunk/ufsutils/debian/changelog	2014-02-22 13:02:49 UTC (rev 5440)
@@ -1,3 +1,10 @@
+ufsutils (10.0-2) UNRELEASED; urgency=low
+
+  * 05_wipe_otherfs.patch: Handle DIOCGMEDIASIZE failure gracefully.
+    (Closes: #737580)
+
+ -- Robert Millan <rmh at debian.org>  Sat, 22 Feb 2014 14:02:36 +0100
+
 ufsutils (10.0-1) experimental; urgency=low
 
   * New upstream release.

Modified: trunk/ufsutils/debian/patches/05_wipe_otherfs.patch
===================================================================
--- trunk/ufsutils/debian/patches/05_wipe_otherfs.patch	2014-02-21 22:58:06 UTC (rev 5439)
+++ trunk/ufsutils/debian/patches/05_wipe_otherfs.patch	2014-02-22 13:02:49 UTC (rev 5440)
@@ -8,27 +8,31 @@
  #include <sys/mman.h>
  #include <sys/resource.h>
  #include <sys/stat.h>
-@@ -531,6 +532,24 @@
+@@ -531,6 +532,28 @@
  			}
  		}
  	}
 +	/* Wipe out other file systems. For now we erase first and last 512 kiB
 +	 * (this works for at least UFS1 and ZFS). */
 +	if (!Eflag && !Nflag) {
-+		off_t mediasize;
-+		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize))
-+			err(1, "DIOCGMEDIASIZE");
++		off_t mediasize = 0;
++
 +		printf("Erasing sectors [%jd...%jd]\n",
 +			sblock.fs_sblockloc / disk.d_bsize,
 +			fsbtodb(&sblock, sblock.fs_size) - 1);
 +		berase(&disk, sblock.fs_sblockloc / disk.d_bsize,
 +			1024 * disk.d_bsize - sblock.fs_sblockloc);
 +
-+		printf("Erasing sectors [%jd...%jd]\n",
-+			(mediasize - 1024 * 512) / disk.d_bsize,
-+			(mediasize / disk.d_bsize) - 1);
-+		berase(&disk, (mediasize - 1024 * 512) / disk.d_bsize,
-+			1024 * 512);
++		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize))
++			warn("DIOCGMEDIASIZE");
++
++		if (mediasize) {
++			printf("Erasing sectors [%jd...%jd]\n",
++				(mediasize - 1024 * 512) / disk.d_bsize,
++				(mediasize / disk.d_bsize) - 1);
++			berase(&disk, (mediasize - 1024 * 512) / disk.d_bsize,
++				1024 * 512);
++		}
 +	}
  	if (!Nflag)
  		do_sbwrite(&disk);




More information about the Glibc-bsd-commits mailing list