diff options
author | Karel Zak | 2016-09-22 13:47:23 +0200 |
---|---|---|
committer | Karel Zak | 2016-09-22 13:47:23 +0200 |
commit | 02aaba6f9f4e20bd259655694eee58a435dae769 (patch) | |
tree | 7c4828d33867f67442cc0f79a34447a0b574deea /libsmartcols | |
parent | swapon: fix discard option parsing (diff) | |
download | kernel-qcow2-util-linux-02aaba6f9f4e20bd259655694eee58a435dae769.tar.gz kernel-qcow2-util-linux-02aaba6f9f4e20bd259655694eee58a435dae769.tar.xz kernel-qcow2-util-linux-02aaba6f9f4e20bd259655694eee58a435dae769.zip |
libsmartcols: keep scols_table_get_termwidth() read-only
Addresses: https://github.com/karelzak/util-linux/issues/356
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols')
-rw-r--r-- | libsmartcols/src/table.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index 9aae75c95..4040b4365 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -68,6 +68,7 @@ struct libscols_table *scols_new_table(void) tb->refcount = 1; tb->out = stdout; + tb->termwidth = get_terminal_width(80); INIT_LIST_HEAD(&tb->tb_lines); INIT_LIST_HEAD(&tb->tb_columns); @@ -1154,7 +1155,5 @@ int scols_table_set_termwidth(struct libscols_table *tb, size_t width) */ size_t scols_table_get_termwidth(struct libscols_table *tb) { - if (tb->termwidth == 0) - tb->termwidth = get_terminal_width(80); return tb->termwidth; } |