mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
(xfclose): Return void, not int, since it always returned zero.
Report I/O error if ferror indicates one.
This commit is contained in:
14
src/files.c
14
src/files.c
@@ -120,19 +120,17 @@ xfopen (const char *name, const char *mode)
|
||||
| Try to close file PTR, and print an error message if fails. |
|
||||
`-------------------------------------------------------------*/
|
||||
|
||||
int
|
||||
void
|
||||
xfclose (FILE *ptr)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (ptr == NULL)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
result = fclose (ptr);
|
||||
if (result == EOF)
|
||||
if (ferror (ptr))
|
||||
error (EXIT_FAILURE, 0, _("I/O error"));
|
||||
|
||||
if (fclose (ptr) != 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot close file"));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user