1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

common: New functions gnupg_opendir et al.

* common/sysutils.h (struct gnupg_dirent_s): New.
* common/sysutils.c: Include dirent.h.
(struct gnupg_dir_s): New.
(gnupg_opendir, gnupg_readdir, gnupg_closedir): New.  Change all
callers of opendir, readdir, and closedir to use these functions.
--

GnuPG-bug-id: 5098
This commit is contained in:
Werner Koch 2020-10-21 16:59:38 +02:00
parent 9a0197b6fe
commit 7e22e08e2a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
9 changed files with 217 additions and 43 deletions

View file

@ -364,8 +364,8 @@ static gpg_error_t
load_certs_from_dir (const char *dirname, unsigned int trustclass)
{
gpg_error_t err;
DIR *dir;
struct dirent *ep;
gnupg_dir_t dir;
gnupg_dirent_t ep;
char *p;
size_t n;
estream_t fp;
@ -373,13 +373,13 @@ load_certs_from_dir (const char *dirname, unsigned int trustclass)
ksba_cert_t cert;
char *fname = NULL;
dir = opendir (dirname);
dir = gnupg_opendir (dirname);
if (!dir)
{
return 0; /* We do not consider this a severe error. */
}
while ( (ep=readdir (dir)) )
while ( (ep = gnupg_readdir (dir)) )
{
p = ep->d_name;
if (*p == '.' || !*p)
@ -447,7 +447,7 @@ load_certs_from_dir (const char *dirname, unsigned int trustclass)
}
xfree (fname);
closedir (dir);
gnupg_closedir (dir);
return 0;
}