summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-01-11 16:52:47 +0000
committerJim Meyering <jim@meyering.net>2005-01-11 16:52:47 +0000
commit1377220ccf3362dd08832c711ca14a1fe3381697 (patch)
tree32cb6685b571b968cca5a1a2c41c16bb491b5f02 /src
parent0814364bbe477497d496daedc30b224edce5efde (diff)
downloadcoreutils-1377220ccf3362dd08832c711ca14a1fe3381697.tar.xz
(add_tab_stop): Properly diagnose a tabstop list with decreasing values.
Diffstat (limited to 'src')
-rw-r--r--src/unexpand.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/unexpand.c b/src/unexpand.c
index 27fc6fec5..1341e437c 100644
--- a/src/unexpand.c
+++ b/src/unexpand.c
@@ -1,5 +1,5 @@
/* unexpand - convert blanks to tabs
- Copyright (C) 89, 91, 1995-2004 Free Software Foundation, Inc.
+ Copyright (C) 89, 91, 1995-2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -149,8 +149,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
static void
add_tab_stop (uintmax_t tabval)
{
- uintmax_t column_width =
- tabval - (first_free_tab ? tab_list[first_free_tab - 1] : 0);
+ uintmax_t prev_column = first_free_tab ? tab_list[first_free_tab - 1] : 0;
+ uintmax_t column_width = prev_column <= tabval ? tabval - prev_column : 0;
if (first_free_tab == n_tabs_allocated)
tab_list = x2nrealloc (tab_list, &n_tabs_allocated, sizeof *tab_list);