1
0
Fork 0
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
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

@ -50,6 +50,19 @@ typedef int gnupg_fd_t;
# include <sys/stat.h>
#endif
struct gnupg_dir_s;
typedef struct gnupg_dir_s *gnupg_dir_t;
struct gnupg_dirent_s
{
/* We don't have a d_ino because that can't be used on Windows
* anyway. D_NAME is a pointer into the gnupg_dir_s which has a
* static buffer or allocates sufficient space as needed. This is
* only valid after gnupg_readdir. */
char *d_name;
};
typedef struct gnupg_dirent_s *gnupg_dirent_t;
void trap_unaligned (void);
int disable_core_dumps (void);
int enable_core_dumps (void);
@ -81,6 +94,11 @@ gpg_err_code_t gnupg_access (const char *name, int mode);
int gnupg_stat (const char *name, struct stat *statbuf);
#endif /*HAVE_STAT*/
int gnupg_open (const char *name, int flags, unsigned int mode);
gnupg_dir_t gnupg_opendir (const char *name);
gnupg_dirent_t gnupg_readdir (gnupg_dir_t gdir);
int gnupg_closedir (gnupg_dir_t gdir);
gpg_error_t gnupg_chuid (const char *user, int silent);
char *gnupg_get_socket_name (int fd);
int gnupg_fd_valid (int fd);