]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: accept no data for custom wrapping cells
authorKarel Zak <kzak@redhat.com>
Tue, 14 Nov 2023 11:46:49 +0000 (12:46 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Nov 2023 11:46:49 +0000 (12:46 +0100)
Don't re-use previously used 'rc' variable, otherwise empty cell will
be interpreted as error.

Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/print.c

index d1e227451797ad88f1fb058457d1edc9172587ae..16c2436b37ca24a3010f1bd275baa21706c06494 100644 (file)
@@ -712,9 +712,11 @@ notree:
 
                        rc = cal ? scols_column_greatest_wrap(cl, ce, &x) :
                                   scols_column_next_wrap(cl, ce, &x);
+                       /* rc: error: <0; nodata: 1; success: 0 */
                        if (rc < 0)
-                               return rc;
+                               goto done;
                        data = x;
+                       rc = 0;
                        if (data && *data)
                                datasiz = strlen(data);
                        if (data && datasiz)
@@ -761,6 +763,9 @@ notree:
        /* reset wrapping after greatest chunk calculation */
        if (cal && scols_column_is_wrap(cl))
                scols_column_reset_wrap(cl);
+
+done:
+       DBG(COL, ul_debugobj(cl, "__cursor_to_buffer rc=%d", rc));
        return rc;
 }