diff options
author | Karel Zak | 2016-01-18 10:36:31 +0100 |
---|---|---|
committer | Karel Zak | 2016-01-18 10:36:31 +0100 |
commit | 7ad4b8503cd66ef9de97f25d374f19cb29181919 (patch) | |
tree | 83a055994042c4267d340d514fcc7b8afc804699 /libsmartcols/src/table.c | |
parent | Merge branch 'gh/254' of https://github.com/ignatenkobrain/util-linux (diff) | |
download | kernel-qcow2-util-linux-7ad4b8503cd66ef9de97f25d374f19cb29181919.tar.gz kernel-qcow2-util-linux-7ad4b8503cd66ef9de97f25d374f19cb29181919.tar.xz kernel-qcow2-util-linux-7ad4b8503cd66ef9de97f25d374f19cb29181919.zip |
libsmartcols: be sure column is unused
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r-- | libsmartcols/src/table.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index 3360d525b..ca1e64825 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -126,13 +126,14 @@ int scols_table_set_name(struct libscols_table *tb, const char *name) * @tb: a pointer to a struct libscols_table instance * @cl: a pointer to a struct libscols_column instance * - * Adds @cl to @tb's column list. + * Adds @cl to @tb's column list. The column cannot be shared between more + * tables. * * Returns: 0, a negative number in case of an error. */ int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl) { - if (!tb || !cl || !list_empty(&tb->tb_lines)) + if (!tb || !cl || !list_empty(&tb->tb_lines) || cl->table) return -EINVAL; if (cl->flags & SCOLS_FL_TREE) |