summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorKarel Zak2017-05-17 13:08:33 +0200
committerKarel Zak2017-05-17 13:08:33 +0200
commitb7ebf49c9b203b5f54ef2aa486b64b811650641f (patch)
treefc0fcd8a40b746817836db5850ac69895780343f /misc-utils
parentnologin: don't call fstat() after failed open() [coverity scan] (diff)
downloadkernel-qcow2-util-linux-b7ebf49c9b203b5f54ef2aa486b64b811650641f.tar.gz
kernel-qcow2-util-linux-b7ebf49c9b203b5f54ef2aa486b64b811650641f.tar.xz
kernel-qcow2-util-linux-b7ebf49c9b203b5f54ef2aa486b64b811650641f.zip
fincore: check rc from smartcols stuff [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/fincore.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/misc-utils/fincore.c b/misc-utils/fincore.c
index 6a29f375a..28103ad5d 100644
--- a/misc-utils/fincore.c
+++ b/misc-utils/fincore.c
@@ -123,13 +123,15 @@ static int add_output_data(struct fincore_control *ctl,
err(EXIT_FAILURE, _("failed to initialize output line"));
for (i = 0; i < ncolumns; i++) {
+ int rc = 0;
+
switch(get_column_id(i)) {
case COL_FILE:
- scols_line_set_data(ln, i, name);
+ rc = scols_line_set_data(ln, i, name);
break;
case COL_PAGES:
xasprintf(&tmp, "%jd", (intmax_t) count_incore);
- scols_line_refer_data(ln, i, tmp);
+ rc = scols_line_refer_data(ln, i, tmp);
break;
case COL_RES:
{
@@ -139,7 +141,7 @@ static int add_output_data(struct fincore_control *ctl,
xasprintf(&tmp, "%ju", res);
else
tmp = size_to_human_string(SIZE_SUFFIX_1LETTER, res);
- scols_line_refer_data(ln, i, tmp);
+ rc = scols_line_refer_data(ln, i, tmp);
break;
}
case COL_SIZE:
@@ -147,11 +149,14 @@ static int add_output_data(struct fincore_control *ctl,
xasprintf(&tmp, "%jd", (intmax_t) file_size);
else
tmp = size_to_human_string(SIZE_SUFFIX_1LETTER, file_size);
- scols_line_refer_data(ln, i, tmp);
+ rc = scols_line_refer_data(ln, i, tmp);
break;
default:
return -EINVAL;
}
+
+ if (rc)
+ err(EXIT_FAILURE, _("failed to add output data"));
}
return 0;