[PATCH 8/9] util: allow regular files through test_partition()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When using the --dump capability the resulting files cannot be read
unless test_partition allows regular files.

Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
 util.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/util.c b/util.c
index ce03239..5d573bc 100644
--- a/util.c
+++ b/util.c
@@ -279,6 +279,12 @@ int test_partition(int fd)
 	 */
 	struct blkpg_ioctl_arg a;
 	struct blkpg_partition p;
+	struct stat st;
+
+	/* ignore regular files */
+	if (fstat(fd, &st) != -1 && S_ISREG(st.st_mode))
+		return 0;
+
 	a.op = BLKPG_DEL_PARTITION;
 	a.data = (void*)&p;
 	a.datalen = sizeof(p);

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux