summaryrefslogtreecommitdiffstats
path: root/text-utils/column.c
diff options
context:
space:
mode:
authorB Watson2012-08-14 18:27:09 +0200
committerKarel Zak2012-08-14 18:27:09 +0200
commit43f8915c51f1b36c3d1d79d06d58ea5fb27a6cca (patch)
tree11320aa1c7e61345d2726b95a62ae294098d922f /text-utils/column.c
parentlib/sysfs: make sysfs_partno_to_devno better readable (diff)
downloadkernel-qcow2-util-linux-43f8915c51f1b36c3d1d79d06d58ea5fb27a6cca.tar.gz
kernel-qcow2-util-linux-43f8915c51f1b36c3d1d79d06d58ea5fb27a6cca.tar.xz
kernel-qcow2-util-linux-43f8915c51f1b36c3d1d79d06d58ea5fb27a6cca.zip
column: --separator segfaults
The --separator and --columns long options in util-linux-2.21.2 and in a git clone from 5 minutes ago, don't work: $ echo foobar | column -s x foobar $ echo foobar | column -c 10 foobar $ echo foobar | column --separator=x column: option '--separator' doesn't allow an argument $ echo foobar | column --separator x Segmentation fault $ echo foobar | column --columns 10 column: bad columns width value: '(null)': Invalid argument $ echo foobar | column --columns=10 column: option '--columns' doesn't allow an argument Looks like a simple case of missing has_arg flag in the "struct option" initialization for these two options. The patch just adds the flag. I haven't done thorough testing of the patched code, but it seems to work OK and it no longer segfaults or tries to dereference a null pointer. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/column.c')
-rw-r--r--text-utils/column.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/text-utils/column.c b/text-utils/column.c
index aab9187ea..f33cc1447 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -121,9 +121,9 @@ int main(int argc, char **argv)
{
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'V' },
- { "columns", 0, 0, 'c' },
+ { "columns", 1, 0, 'c' },
{ "table", 0, 0, 't' },
- { "separator", 0, 0, 's' },
+ { "separator", 1, 0, 's' },
{ "fillrows", 0, 0, 'x' },
{ NULL, 0, 0, 0 },
};