1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-09 23:39:51 +02:00

gpg: Use gnupg_fd_t for iobuf_get_fd and is_secured_file.

* common/iobuf.c (iobuf_get_fd): Return type is now gnupg_fd_t.
* common/iobuf.h (iobuf_get_fd): Fix the return type.
* g10/misc.c (is_secured_file): Argument is now gnupg_fd_t.
* g10/main.h (is_secured_file): Fix the argument type.

--

GnuPG-bug-id: 6580
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-07-14 15:52:08 +09:00
parent 5d375bb168
commit ee9e3578ce
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
4 changed files with 6 additions and 6 deletions

View File

@ -2641,20 +2641,20 @@ iobuf_get_filelength (iobuf_t a)
} }
int gnupg_fd_t
iobuf_get_fd (iobuf_t a) iobuf_get_fd (iobuf_t a)
{ {
for (; a->chain; a = a->chain) for (; a->chain; a = a->chain)
; ;
if (a->filter != file_filter) if (a->filter != file_filter)
return -1; return GNUPG_INVALID_FD;
{ {
file_filter_ctx_t *b = a->filter_ov; file_filter_ctx_t *b = a->filter_ov;
gnupg_fd_t fp = b->fp; gnupg_fd_t fp = b->fp;
return FD2INT (fp); return fp;
} }
} }

View File

@ -590,7 +590,7 @@ uint64_t iobuf_get_filelength (iobuf_t a);
/* Return the file descriptor designating the underlying file. This /* Return the file descriptor designating the underlying file. This
only works with file_filter based pipelines. */ only works with file_filter based pipelines. */
int iobuf_get_fd (iobuf_t a); gnupg_fd_t iobuf_get_fd (iobuf_t a);
/* Return the real filename, if available. This only supports /* Return the real filename, if available. This only supports
pipelines that end in file filters. Returns NULL if not pipelines that end in file filters. Returns NULL if not

View File

@ -107,7 +107,7 @@ char *make_radix64_string( const byte *data, size_t len );
void trap_unaligned(void); void trap_unaligned(void);
void register_secured_file (const char *fname); void register_secured_file (const char *fname);
void unregister_secured_file (const char *fname); void unregister_secured_file (const char *fname);
int is_secured_file (int fd); int is_secured_file (gnupg_fd_t fd);
int is_secured_filename (const char *fname); int is_secured_filename (const char *fname);
u16 checksum_u16( unsigned n ); u16 checksum_u16( unsigned n );
u16 checksum( const byte *p, unsigned n ); u16 checksum( const byte *p, unsigned n );

View File

@ -160,7 +160,7 @@ unregister_secured_file (const char *fname)
/* Return true if FD is corresponds to a secured file. Using -1 for /* Return true if FD is corresponds to a secured file. Using -1 for
FS is allowed and will return false. */ FS is allowed and will return false. */
int int
is_secured_file (int fd) is_secured_file (gnupg_fd_t fd)
{ {
#ifdef ENABLE_SELINUX_HACKS #ifdef ENABLE_SELINUX_HACKS
struct stat buf; struct stat buf;