From 905bc7817ecae1df10e32bed2a0a68c11928ddc9 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 20 Jun 2018 16:41:51 +0200 Subject: [PATCH] lsblk: fix ul_path_read_string() usage Signed-off-by: Karel Zak --- lib/path.c | 8 ++++---- misc-utils/lsblk.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/path.c b/lib/path.c index cfc1c23725..602674956a 100644 --- a/lib/path.c +++ b/lib/path.c @@ -1141,12 +1141,12 @@ int main(int argc, char *argv[]) errx(EXIT_FAILURE, " 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) { diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index a6c78a268f..815ba1d71e 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -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, "-"); -- 2.47.3