mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +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
Backported-from-master: 7e22e08e2a
This commit is contained in:
parent
4252cd7b18
commit
5f8123df78
8 changed files with 210 additions and 37 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue