/[bison]/bison/src/files.c
ViewVC logotype

Diff of /bison/src/files.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.78 by eggert, Tue Oct 22 05:01:46 2002 UTC revision 1.79 by eggert, Wed Oct 30 06:19:00 2002 UTC
# Line 120  xfopen (const char *name, const char *mo Line 120  xfopen (const char *name, const char *mo
120  | Try to close file PTR, and print an error message if fails.  |  | Try to close file PTR, and print an error message if fails.  |
121  `-------------------------------------------------------------*/  `-------------------------------------------------------------*/
122    
123  int  void
124  xfclose (FILE *ptr)  xfclose (FILE *ptr)
125  {  {
   int result;  
   
126    if (ptr == NULL)    if (ptr == NULL)
127      return 0;      return;
128    
129    result = fclose (ptr);    if (ferror (ptr))
130    if (result == EOF)      error (EXIT_FAILURE, 0, _("I/O error"));
     error (EXIT_FAILURE, errno, _("cannot close file"));  
131    
132    return result;    if (fclose (ptr) != 0)
133        error (EXIT_FAILURE, errno, _("cannot close file"));
134  }  }
135    
136    

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.79

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26