]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: (smaple) check scols_line_set_data() return code [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 14 Jul 2020 10:03:11 +0000 (12:03 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Jul 2020 10:03:11 +0000 (12:03 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/samples/maxout.c

index 07a05e13ff27075f8cb2806f6189b964aa5bec3d..263d4de81bde3caeecd6caf94e9e6b515dbb0d1b 100644 (file)
@@ -42,10 +42,15 @@ int main(int argc, char *argv[])
 
        while (nlines--) {
                struct libscols_line *ln = scols_table_new_line(tb, NULL);
-
-               scols_line_set_data(ln, COL_LEFT, "A");
-               scols_line_set_data(ln, COL_FOO, "B");
-               scols_line_set_data(ln, COL_RIGHT, "C");
+               int rc;
+
+               rc = scols_line_set_data(ln, COL_LEFT, "A");
+               if (!rc)
+                       rc = scols_line_set_data(ln, COL_FOO, "B");
+               if (!rc)
+                       rc = scols_line_set_data(ln, COL_RIGHT, "C");
+               if (rc)
+                       err(EXIT_FAILURE, "failed to set line data");
        }
 
        scols_print_table(tb);