Blame SOURCES/0025-partx-don-t-report-ENXIO-as-error-on-d.patch

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