summaryrefslogtreecommitdiffstats
path: root/g10/plaintext.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-03-08 19:19:21 +0100
committerWerner Koch <wk@gnupg.org>2010-03-08 19:19:21 +0100
commit6216d33e8cc1c2d01533b3e9b97dc7009b4f3553 (patch)
tree062bf701637025088b83a9e8684aa7a1eae68fb5 /g10/plaintext.c
parentUse macros for iobuf ioctls. (diff)
downloadgnupg2-6216d33e8cc1c2d01533b3e9b97dc7009b4f3553.tar.xz
gnupg2-6216d33e8cc1c2d01533b3e9b97dc7009b4f3553.zip
Removed almost al dup calls.
Diffstat (limited to 'g10/plaintext.c')
-rw-r--r--g10/plaintext.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/g10/plaintext.c b/g10/plaintext.c
index d1ab92381..ee0d41357 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -1,6 +1,6 @@
/* plaintext.c - process plaintext packets
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- * 2006, 2009 Free Software Foundation, Inc.
+ * 2006, 2009, 2010 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -651,13 +651,14 @@ hash_datafile_by_fd (gcry_md_hd_t md, gcry_md_hd_t md2, int data_fd,
progress_filter_context_t *pfx = new_progress_context ();
iobuf_t fp;
- fp = iobuf_fdopen (data_fd, "rb");
- if (fp && is_secured_file (data_fd))
+ if (is_secured_file (data_fd))
{
- iobuf_close (fp);
fp = NULL;
errno = EPERM;
}
+ else
+ fp = iobuf_fdopen_nc (data_fd, "rb");
+
if (!fp)
{
int rc = gpg_error_from_syserror ();