cdown / rpms / util-linux

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