maint: use gnulib *_safer functions consistently

Avoid using fopen_safer and opendir_safer directly in favor of
letting gnulib transparently doing the work via "dirent--.h" and
"stdio--.h".

* find/oldfind.c (dirent-safer.h): Replace include ...
(dirent--.h): ... by this.
(process_dir): Change opendir_safer to the regular opendir call.
* find/sharefile.c (stdio-safer.h): Replace include ...
(stdio--.h): ... by this.
(sharefile_fopen): Change fopen_safer to regular fopen call.
* lib/fdleak.c (dirent-safer.h): Replace include ...
(dirent--.h): ... by this.
(get_proc_max_fd): Change opendir_safer to regular opendir call.
This commit is contained in:
Bernhard Voelker 2020-12-02 02:00:01 +01:00
parent 160e2f8258
commit dc1a69f6dc
3 changed files with 6 additions and 6 deletions

View File

@ -35,7 +35,7 @@
/* gnulib headers. */
#include "canonicalize.h"
#include "closein.h"
#include "dirent-safer.h"
#include "dirent--.h"
#include "dirname.h"
#include "error.h"
#include "fcntl--.h"
@ -1304,7 +1304,7 @@ process_dir (const char *pathname, const char *name, int pathlen, const struct s
}
errno = 0;
dirp = opendir_safer (name);
dirp = opendir (name);
if (dirp == NULL)
{

View File

@ -29,7 +29,7 @@
/* gnulib headers. */
#include "cloexec.h"
#include "hash.h"
#include "stdio-safer.h"
#include "stdio--.h"
/* find headers. */
#include "sharefile.h"
@ -154,7 +154,7 @@ sharefile_fopen (sharefile_handle h, const char *filename)
return NULL;
}
if (NULL == (new_entry->fp = fopen_safer (filename, p->mode)))
if (NULL == (new_entry->fp = fopen (filename, p->mode)))
{
entry_free (new_entry);
return NULL;

View File

@ -34,7 +34,7 @@
/* gnulib headers. */
#include "cloexec.h"
#include "dirent-safer.h"
#include "dirent--.h"
#include "error.h"
#include "fcntl--.h"
@ -66,7 +66,7 @@ get_proc_max_fd (void)
* a given directory (the manpage for readdir_r claims this
* is the approved method, but the manpage for pathconf indicates
* that _PC_NAME_MAX is not an upper limit). */
DIR *dir = opendir_safer (path);
DIR *dir = opendir (path);
if (dir)
{
int good = 0;