[PATCH 2/4] btrfs-progs: fix segment fault when exec btrfs-debug-tree as non-root

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

 



When exec btrfs-debug-tree as non-root user, we get a segment fault.
Because the btrfs_scan_block_devices return a success 0 when we fail
to open a device. Now we just return the errno if this case happens.

Signed-off-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
---
 utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utils.c b/utils.c
index 97e23d5..1878abc 100644
--- a/utils.c
+++ b/utils.c
@@ -1517,7 +1517,8 @@ scan_again:
 		scans++;
 		goto scan_again;
 	}
-	return 0;
+
+	return errno ? -errno : 0;
 }
 
 u64 parse_size(char *s)
-- 
1.8.1.4

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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux