summaryrefslogtreecommitdiff
path: root/src/tsort.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-04-24 13:48:54 +0000
committerJim Meyering <jim@meyering.net>2003-04-24 13:48:54 +0000
commita3c951764e119735c499d515d2b36ece5c749353 (patch)
treea54a34f4de6b70f3e9401d25d2afb4f3cf984964 /src/tsort.c
parenteafe3a687805445bc76bc6a9cca0ac99d6ef1e67 (diff)
downloadcoreutils-a3c951764e119735c499d515d2b36ece5c749353.tar.xz
(tsort): Fail if the input contains an odd number of tokens.
Diffstat (limited to 'src/tsort.c')
-rw-r--r--src/tsort.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tsort.c b/src/tsort.c
index ebd1d43f9..d7573de82 100644
--- a/src/tsort.c
+++ b/src/tsort.c
@@ -1,5 +1,5 @@
/* tsort - topological sort.
- Copyright (C) 1998-2002 Free Software Foundation, Inc.
+ Copyright (C) 1998-2003 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
@@ -491,6 +491,10 @@ tsort (const char *file)
j = k;
}
+ if (k != NULL)
+ error (EXIT_FAILURE, 0, _("%s: input contains an odd number of tokens"),
+ file);
+
/* T1. Initialize (N <- n). */
walk_tree (root, count_items);