diff options
author | Neal H. Walfield <[email protected]> | 2015-08-13 14:09:15 +0000 |
---|---|---|
committer | Neal H. Walfield <[email protected]> | 2015-08-20 12:16:22 +0000 |
commit | 8402815d8e0e04a44362968f88b3d484d2395402 (patch) | |
tree | f9a5fd9e9fc6cba353219f9be8ddb530c438f4e6 | |
parent | common/iobuf.c: Rename iobuf_flush and make it a static function. (diff) | |
download | gnupg-8402815d8e0e04a44362968f88b3d484d2395402.tar.gz gnupg-8402815d8e0e04a44362968f88b3d484d2395402.zip |
common/iobuf.h: Remove iobuf_open_fd_or_name.
* common/iobuf.h (iobuf_open_fd_or_name): Remove prototype. Replace
use with either iobuf_open or iobuf_fdopen_nc, as appropriate.
* common/iobuf.c (iobuf_open): Remove function.
--
Signed-off-by: Neal H. Walfield <[email protected]>.
-rw-r--r-- | common/iobuf.c | 17 | ||||
-rw-r--r-- | common/iobuf.h | 2 | ||||
-rw-r--r-- | g10/decrypt.c | 2 | ||||
-rw-r--r-- | g10/encrypt.c | 7 |
4 files changed, 6 insertions, 22 deletions
diff --git a/common/iobuf.c b/common/iobuf.c index 66f669ba8..9d3ce9897 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -1301,23 +1301,6 @@ iobuf_is_pipe_filename (const char *fname) } -/* Either open the file specified by the file descriptor FD or - if FD - is -1, the file with name FNAME. As of now MODE is assumed to be - "rb" if FNAME is used. In contrast to iobuf_fdopen the file - descriptor FD will not be closed during an iobuf_close. */ -iobuf_t -iobuf_open_fd_or_name (gnupg_fd_t fd, const char *fname, const char *mode) -{ - iobuf_t a; - - if (fd == GNUPG_INVALID_FD) - a = iobuf_open (fname); - else - a = iobuf_fdopen_nc (FD2INT(fd), mode); - return a; -} - - /**************** * Create a head iobuf for reading from a file * returns: NULL if an error occures and sets errno diff --git a/common/iobuf.h b/common/iobuf.h index 18e1be14c..5cfccb8f0 100644 --- a/common/iobuf.h +++ b/common/iobuf.h @@ -118,8 +118,6 @@ int iobuf_is_pipe_filename (const char *fname); iobuf_t iobuf_alloc (int use, size_t bufsize); iobuf_t iobuf_temp (void); iobuf_t iobuf_temp_with_content (const char *buffer, size_t length); -iobuf_t iobuf_open_fd_or_name (gnupg_fd_t fd, const char *fname, - const char *mode); iobuf_t iobuf_open (const char *fname); iobuf_t iobuf_fdopen (int fd, const char *mode); iobuf_t iobuf_fdopen_nc (int fd, const char *mode); diff --git a/g10/decrypt.c b/g10/decrypt.c index fe6fd6389..068b64aed 100644 --- a/g10/decrypt.c +++ b/g10/decrypt.c @@ -120,7 +120,7 @@ decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd) pfx = new_progress_context (); /* Open the message file. */ - fp = iobuf_open_fd_or_name (input_fd, NULL, "rb"); + fp = iobuf_fdopen_nc (FD2INT(input_fd), "rb"); if (fp && is_secured_file (iobuf_get_fd (fp))) { iobuf_close (fp); diff --git a/g10/encrypt.c b/g10/encrypt.c index d5835d499..e2e1c05da 100644 --- a/g10/encrypt.c +++ b/g10/encrypt.c @@ -510,14 +510,17 @@ encrypt_crypt (ctrl_t ctrl, int filefd, const char *filename, /* Prepare iobufs. */ #ifdef HAVE_W32_SYSTEM if (filefd == -1) - inp = iobuf_open_fd_or_name (GNUPG_INVALID_FD, filename, "rb"); + inp = iobuf_open (filename); else { inp = NULL; gpg_err_set_errno (ENOSYS); } #else - inp = iobuf_open_fd_or_name (filefd, filename, "rb"); + if (filefd == GNUPG_INVALID_FD) + inp = iobuf_open (filename); + else + inp = iobuf_fdopen_nc (FD2INT(filefd), "rb"); #endif if (inp) iobuf_ioctl (inp, IOBUF_IOCTL_NO_CACHE, 1, NULL); |