summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table.c
diff options
context:
space:
mode:
authorKarel Zak2016-01-18 10:47:22 +0100
committerKarel Zak2016-01-18 10:47:22 +0100
commit8afabdb1fa1388c022101d0a8ab932bcaa3c8e34 (patch)
treeea1908b05037d79c76ffd36af97c832fd0609a1b /libsmartcols/src/table.c
parentlibsmartcols: be sure column is unused (diff)
downloadkernel-qcow2-util-linux-8afabdb1fa1388c022101d0a8ab932bcaa3c8e34.tar.gz
kernel-qcow2-util-linux-8afabdb1fa1388c022101d0a8ab932bcaa3c8e34.tar.xz
kernel-qcow2-util-linux-8afabdb1fa1388c022101d0a8ab932bcaa3c8e34.zip
libsmartcols: don't sort if cmpfunc() is not set
Reported-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r--libsmartcols/src/table.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index ca1e64825..7885ba249 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -1075,7 +1075,7 @@ static int cells_cmp_wrapper(struct list_head *a, struct list_head *b, void *dat
*/
int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl)
{
- if (!tb || !cl)
+ if (!tb || !cl || !cl->cmpfunc)
return -EINVAL;
DBG(TAB, ul_debugobj(tb, "sorting table"));