(open_file): Use fopen_safer.
(close_file): Don't assume fopen does not return stdin.
#include "inttostr.h"
#include "mbswidth.h"
#include "posixver.h"
+#include "stdio-safer.h"
#include "strftime.h"
#include "xstrtol.h"
else
{
p->name = name;
- p->fp = fopen (name, "r");
+ p->fp = fopen_safer (name, "r");
}
if (p->fp == NULL)
{
return;
if (ferror (p->fp))
error (EXIT_FAILURE, errno, "%s", p->name);
- if (p->fp != stdin && fclose (p->fp) == EOF)
+ if (fileno (p->fp) != STDIN_FILENO && fclose (p->fp) != 0)
error (EXIT_FAILURE, errno, "%s", p->name);
if (!parallel_files)