summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--partx/partx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/partx/partx.c b/partx/partx.c
index 43b59a254..e5f4319c8 100644
--- a/partx/partx.c
+++ b/partx/partx.c
@@ -165,14 +165,16 @@ static int get_partno_from_device(char *partition, dev_t devno)
if (devno) {
struct sysfs_cxt cxt;
+ int rc;
if (sysfs_init(&cxt, devno, NULL))
goto err;
- if (sysfs_read_int(&cxt, "partition", &partno) >= 0) {
- sysfs_deinit(&cxt);
+ rc = sysfs_read_int(&cxt, "partition", &partno);
+ sysfs_deinit(&cxt);
+
+ if (rc == 0)
return partno;
- }
}
sz = strlen(partition);