]> git.saurik.com Git - bison.git/commitdiff
(xfclose): Return void, not int, since it always returned zero.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 30 Oct 2002 06:19:00 +0000 (06:19 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 30 Oct 2002 06:19:00 +0000 (06:19 +0000)
Report I/O error if ferror indicates one.

src/files.c

index 92573585a491e6d5f92c84ac2159ca86214bffff..da4c36b1e9a865ed82ac3209efe7df744e63ba3f 100644 (file)
@@ -120,19 +120,17 @@ xfopen (const char *name, const char *mode)
 | Try to close file PTR, and print an error message if fails.  |
 `-------------------------------------------------------------*/
 
 | Try to close file PTR, and print an error message if fails.  |
 `-------------------------------------------------------------*/
 
-int
+void
 xfclose (FILE *ptr)
 {
 xfclose (FILE *ptr)
 {
-  int result;
-
   if (ptr == NULL)
   if (ptr == NULL)
-    return 0;
+    return;
 
 
-  result = fclose (ptr);
-  if (result == EOF)
-    error (EXIT_FAILURE, errno, _("cannot close file"));
+  if (ferror (ptr))
+    error (EXIT_FAILURE, 0, _("I/O error"));
 
 
-  return result;
+  if (fclose (ptr) != 0)
+    error (EXIT_FAILURE, errno, _("cannot close file"));
 }
 \f
 
 }
 \f