(get_line): Report error right away if I/O fails,
authorJim Meyering <jim@meyering.net>
Tue, 23 Sep 2003 21:57:52 +0000 (21:57 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 23 Sep 2003 21:57:52 +0000 (21:57 +0000)
so that the proper errno value is used.

src/join.c

index e82b66fe2ba8191e4ef2af22f8b66fe7ee9d5db1..b4d1cbb86dc2a963149d953010206eeb105ff057 100644 (file)
@@ -261,6 +261,8 @@ get_line (FILE *fp, struct line *line)
 
   if (! readlinebuffer (&line->buf, fp))
     {
+      if (ferror (fp))
+       error (EXIT_FAILURE, errno, _("read error"));
       free (line->buf.buffer);
       line->buf.buffer = NULL;
       return 0;