]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
date: diagnose -f read errors
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Mar 2023 08:52:43 +0000 (01:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Mar 2023 08:53:06 +0000 (01:53 -0700)
* src/date.c (batch_convert): Diagnose read errors, fixing Bug#62497.

src/date.c

index 0f2012761d712c7254ffcc98e4e0dfa88f08cedd..bc4cc0ce95ce402b2d96a77238448c97e678f999 100644 (file)
@@ -368,7 +368,9 @@ batch_convert (char const *input_filename, char const *format,
       ssize_t line_length = getline (&line, &buflen, in_stream);
       if (line_length < 0)
         {
-          /* FIXME: detect/handle error here.  */
+          if (ferror (in_stream))
+            die (EXIT_FAILURE, errno, _("%s: read error"),
+                 quotef (input_filename));
           break;
         }