]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
partx: check sysfs_init() return value [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 12:27:07 +0000 (13:27 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 12:27:07 +0000 (13:27 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
partx/partx.c

index befc0d02736e33b07ce2dd0083b25f03ad17887d..43b59a254207798c991c7141d0f7b35192fe9ff4 100644 (file)
@@ -166,7 +166,9 @@ static int get_partno_from_device(char *partition, dev_t devno)
        if (devno) {
                struct sysfs_cxt cxt;
 
-               sysfs_init(&cxt, devno, NULL);
+               if (sysfs_init(&cxt, devno, NULL))
+                       goto err;
+
                if (sysfs_read_int(&cxt, "partition", &partno) >= 0) {
                        sysfs_deinit(&cxt);
                        return partno;