]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: fix ul_path_read_string() usage
authorKarel Zak <kzak@redhat.com>
Wed, 20 Jun 2018 14:41:51 +0000 (16:41 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2018 11:19:28 +0000 (13:19 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/path.c
misc-utils/lsblk.c

index cfc1c23725ae4a1716531cdcd3ae057db584bf2b..602674956a400fe235ea14cc59aac8cfdae13fde 100644 (file)
@@ -1141,12 +1141,12 @@ int main(int argc, char *argv[])
                        errx(EXIT_FAILURE, "<file> not defined");
                file = argv[optind++];
 
-               if (ul_path_read_string(pc, &res, file) != 0)
-                       err(EXIT_FAILURE, "read u64 failed");
+               if (ul_path_read_string(pc, &res, file) < 0)
+                       err(EXIT_FAILURE, "read string failed");
                printf("read:  %s: %s\n", file, res);
 
-               if (ul_path_readf_string(pc, &res, "%s", file) != 0)
-                       err(EXIT_FAILURE, "readf u64 failed");
+               if (ul_path_readf_string(pc, &res, "%s", file) < 0)
+                       err(EXIT_FAILURE, "readf string failed");
                printf("readf: %s: %s\n", file, res);
 
        } else if (strcmp(command, "read-link") == 0) {
index a6c78a268f524c0ab513cb9c6e3b0696d45ee79c..815ba1d71ea7487cf8c37054165fa55c42506e93 100644 (file)
@@ -716,7 +716,7 @@ static char *get_type(struct blkdev_cxt *cxt)
 
                /* The DM_UUID prefix should be set to subsystem owning
                 * the device - LVM, CRYPT, DMRAID, MPATH, PART */
-               if (ul_path_read_string(cxt->sysfs, &dm_uuid, "dm/uuid") == 0
+               if (ul_path_read_string(cxt->sysfs, &dm_uuid, "dm/uuid") > 0
                    && dm_uuid) {
                        char *tmp = dm_uuid;
                        char *dm_uuid_prefix = strsep(&tmp, "-");