From: Karel Zak Date: Wed, 23 Apr 2025 09:14:09 +0000 (+0200) Subject: swapoff: check blkid_probe_lookup_value() return code [coverity scan] X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=904789e9a5c82179493d92e2e36f1cfbf2ba8f81;p=thirdparty%2Futil-linux.git swapoff: check blkid_probe_lookup_value() return code [coverity scan] Signed-off-by: Karel Zak --- diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 86258dfd3..2682de1d7 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -57,6 +57,8 @@ /* column IDs */ enum { + COL_TARGET, /* Keep it first to make --output-all readable */ + COL_ACTION, COL_AVAIL, COL_FREQ, @@ -82,7 +84,6 @@ enum { COL_SIZE, COL_SOURCE, COL_SOURCES, - COL_TARGET, COL_TID, COL_UNIQ_ID, COL_USED, diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 9f252d079..7daa7f58f 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -68,7 +68,9 @@ static int column_id_to_number(int id); /* column IDs */ enum { - COL_ALIOFF = 0, + COL_NAME, /* Keep it first to make --output-all readable */ + + COL_ALIOFF, COL_IDLINK, COL_ID, COL_DALIGN, @@ -97,7 +99,6 @@ enum { COL_MODE, COL_MODEL, COL_MQ, - COL_NAME, COL_OPTIO, COL_OWNER, COL_PARTFLAGS, diff --git a/sys-utils/swapoff.c b/sys-utils/swapoff.c index 70422c9e2..21c8e1ee8 100644 --- a/sys-utils/swapoff.c +++ b/sys-utils/swapoff.c @@ -81,9 +81,10 @@ static char *resolve_swapfile_tag(const char *name, const char *value) pr = get_swap_prober(src); if (!pr) continue; - blkid_probe_lookup_value(pr, name, &data, NULL); - if (data && strcmp(data, value) == 0) + if (blkid_probe_lookup_value(pr, name, &data, NULL) == 0 + && data && strcmp(data, value) == 0) path = xstrdup(src); + blkid_free_probe(pr); if (path) break;