mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 17:53:02 +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. |
|
| 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 (ferror (ptr))
|
||||||
if (result == EOF)
|
error (EXIT_FAILURE, 0, _("I/O error"));
|
||||||
|
|
||||||
|
if (fclose (ptr) != 0)
|
||||||
error (EXIT_FAILURE, errno, _("cannot close file"));
|
error (EXIT_FAILURE, errno, _("cannot close file"));
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user