dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
05ad79
diff -up util-linux-2.23.2/lib/loopdev.c.kzak util-linux-2.23.2/lib/loopdev.c
05ad79
--- util-linux-2.23.2/lib/loopdev.c.kzak	2014-09-25 10:16:23.521897462 +0200
05ad79
+++ util-linux-2.23.2/lib/loopdev.c	2014-09-25 10:23:38.852050990 +0200
05ad79
@@ -1129,6 +1129,12 @@ static int loopcxt_check_size(struct loo
05ad79
 		return -errno;
05ad79
 	}
05ad79
 
05ad79
+	/* It's block device, so, align to 512-byte sectors */
05ad79
+	if (expected_size % 512) {
05ad79
+		DBG(lc, loopdev_debug("expected size misaligned to 512-byte sectors"));
05ad79
+		expected_size = (expected_size >> 9) << 9;
05ad79
+	}
05ad79
+
05ad79
 	if (expected_size != size) {
05ad79
 		DBG(lc, loopdev_debug("warning: loopdev and expected "
05ad79
 				      "size dismatch (%ju/%ju)",
05ad79
diff -up util-linux-2.23.2/sys-utils/losetup.c.kzak util-linux-2.23.2/sys-utils/losetup.c
05ad79
--- util-linux-2.23.2/sys-utils/losetup.c.kzak	2014-09-25 10:16:23.521897462 +0200
05ad79
+++ util-linux-2.23.2/sys-utils/losetup.c	2014-09-25 10:23:38.852050990 +0200
05ad79
@@ -632,11 +632,7 @@ int main(int argc, char **argv)
05ad79
 			/* errors */
05ad79
 			errpre = hasdev && loopcxt_get_fd(&lc) < 0 ?
05ad79
 					 loopcxt_get_device(&lc) : file;
05ad79
-			if (errno == ERANGE && offset && offset % 512)
05ad79
-				warnx(_("%s: failed to set up loop device, "
05ad79
-					"offset is not 512-byte aligned."), errpre);
05ad79
-			else
05ad79
-				warn(_("%s: failed to set up loop device"), errpre);
05ad79
+			warn(_("%s: failed to set up loop device"), errpre);
05ad79
 			break;
05ad79
 		} while (hasdev == 0);
05ad79