]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: don't sort if cmpfunc() is not set
authorKarel Zak <kzak@redhat.com>
Mon, 18 Jan 2016 09:47:22 +0000 (10:47 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Jan 2016 09:47:22 +0000 (10:47 +0100)
Reported-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
libsmartcols/src/table.c

index ca1e64825a89f431f4d1ce48564e2abdafc5a3c5..7885ba249921c864830c33a3e29f9b80313c3ce3 100644 (file)
@@ -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"));