cdown / rpms / util-linux

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