diff options
| author | Karel Zak <kzak@redhat.com> | 2024-04-22 11:51:56 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2024-04-22 12:01:33 +0200 |
| commit | af4c7dac191abadc33aae75916583c890cd2ebc3 (patch) | |
| tree | 92b2a41daa44de84a588e5a97ff7f4cb2f1d283f /misc-utils/lsblk.c | |
| parent | 6594679e9af805075c282da35b1b2a8d767e403b (diff) | |
| download | util-linux-af4c7dac191abadc33aae75916583c890cd2ebc3.tar.gz | |
lsblk: simplify SOURCES code
This complicated implementation originated from an early version of
zero-separated items for libsmartcols. It is no longer necessary.
References: https://github.com/util-linux/util-linux/pull/2983
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
| -rw-r--r-- | misc-utils/lsblk.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index fbc0356451..2df7752670 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -935,8 +935,7 @@ static char *device_get_data( ul_buffer_append_string(&buf, "[SWAP]"); else ul_buffer_append_string(&buf, mnt_fs_get_target(fs)); - if (i + 1 < n) - ul_buffer_append_data(&buf, "\0", 1); + ul_buffer_append_data(&buf, "\0", 1); } str = ul_buffer_get_data(&buf, datasiz, NULL); break; @@ -953,8 +952,7 @@ static char *device_get_data( if (mnt_fs_is_swaparea(fs)) continue; ul_buffer_append_string(&buf, root ? root : "/"); - if (i + 1 < n) - ul_buffer_append_data(&buf, "\0", 1); + ul_buffer_append_data(&buf, "\0", 1); } str = ul_buffer_get_data(&buf, datasiz, NULL); break; @@ -1276,7 +1274,7 @@ static void device_fill_scols_cell(struct lsblk_device *dev, ce = scols_line_get_cell(ln, colnum); if (!ce) return; - rc = datasiz ? scols_cell_refer_memory(ce, data, datasiz + 1) + rc = datasiz ? scols_cell_refer_memory(ce, data, datasiz) : scols_cell_refer_data(ce, data); if (rc) err(EXIT_FAILURE, _("failed to add output data")); |
