]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(tsort): Fail if the input contains an odd number of tokens.
authorJim Meyering <jim@meyering.net>
Thu, 24 Apr 2003 13:48:54 +0000 (13:48 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 24 Apr 2003 13:48:54 +0000 (13:48 +0000)
src/tsort.c

index ebd1d43f9cf7361256e3f154c2f5a341ad72e29f..d7573de821b04af0e9fb286a9def8795d58438f6 100644 (file)
@@ -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);