diff options
author | Pádraig Brady <P@draigBrady.com> | 2023-04-22 21:41:53 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2023-04-24 11:46:28 +0100 |
commit | 0e62ba282ef44567a73f93d77583a838447d7550 (patch) | |
tree | 1d04a92ffb7d85737c55a88bc323639666990433 /src/tsort.c | |
parent | 9d333aca433c5c7ae988d262130eb7e0c81819cf (diff) | |
download | coreutils-0e62ba282ef44567a73f93d77583a838447d7550.tar.gz |
tsort: diagnose errors reading the input
* src/tsort.c (tsort): Check for errors after readtoken().
* NEWS: Mention the bug fix.
Diffstat (limited to 'src/tsort.c')
-rw-r--r-- | src/tsort.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tsort.c b/src/tsort.c index 0032cb5d0..2775fb39e 100644 --- a/src/tsort.c +++ b/src/tsort.c @@ -453,7 +453,11 @@ tsort (char const *file) /* T2. Next Relation. */ size_t len = readtoken (stdin, DELIM, sizeof (DELIM) - 1, &tokenbuffer); if (len == (size_t) -1) - break; + { + if (ferror (stdin)) + die (EXIT_FAILURE, errno, _("%s: read error"), quotef (file)); + break; + } assert (len != 0); |