cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
fe1ca8
From be5e6b14db3cdd09dab711572116d7ee39344875 Mon Sep 17 00:00:00 2001
fe1ca8
From: Karel Zak <kzak@redhat.com>
fe1ca8
Date: Wed, 21 Aug 2019 10:51:18 +0200
fe1ca8
Subject: [PATCH 25/26] partx: don't report ENXIO as error on -d
fe1ca8
fe1ca8
The errno ENXIO should be ignored, unfortunately the current code uses
fe1ca8
variable 'rc' for ioctl return code as well as for final del_parts()
fe1ca8
return value. So, failed ioctl (which should be ignored) affects all
fe1ca8
del_parts() status.
fe1ca8
fe1ca8
  # modprobe scsi_debug dev_size_mb=100
fe1ca8
  # partx  -d --nr 1-1024 /dev/sdc; echo $?
fe1ca8
  1
fe1ca8
fe1ca8
The device dos not contains any partitions, so 0 return code is
fe1ca8
expected in this case.
fe1ca8
fe1ca8
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1739179
fe1ca8
Upstream: http://github.com/karelzak/util-linux/commit/53ae7d60cfeacd4e87bfe6fcc015b58b78ef4555
fe1ca8
Signed-off-by: Karel Zak <kzak@redhat.com>
fe1ca8
---
fe1ca8
 disk-utils/partx.c | 3 +--
fe1ca8
 1 file changed, 1 insertion(+), 2 deletions(-)
fe1ca8
fe1ca8
diff --git a/disk-utils/partx.c b/disk-utils/partx.c
fe1ca8
index e3443ea80..f3dcc9007 100644
fe1ca8
--- a/disk-utils/partx.c
fe1ca8
+++ b/disk-utils/partx.c
fe1ca8
@@ -327,8 +327,7 @@ static int del_parts(int fd, const char *device, dev_t devno,
fe1ca8
 	}
fe1ca8
 
fe1ca8
 	for (i = lower; i <= upper; i++) {
fe1ca8
-		rc = partx_del_partition(fd, i);
fe1ca8
-		if (rc == 0) {
fe1ca8
+		if (partx_del_partition(fd, i) == 0) {
fe1ca8
 			if (verbose)
fe1ca8
 				printf(_("%s: partition #%d removed\n"), device, i);
fe1ca8
 			continue;
fe1ca8
-- 
fe1ca8
2.21.0
fe1ca8