summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS2
-rw-r--r--agent/ChangeLog4
-rw-r--r--agent/Makefile.am2
-rw-r--r--am/cmacros.am6
-rw-r--r--common/ChangeLog7
-rw-r--r--common/asshelp.c41
-rw-r--r--dirmngr/ChangeLog5
-rw-r--r--dirmngr/Makefile.am6
-rw-r--r--g10/ChangeLog10
-rw-r--r--g10/Makefile.am2
-rw-r--r--g10/decrypt.c4
-rw-r--r--g10/options.h2
-rw-r--r--g10/plaintext.c147
-rw-r--r--sm/ChangeLog4
-rw-r--r--sm/Makefile.am1
-rw-r--r--tools/ChangeLog4
-rw-r--r--tools/Makefile.am1
18 files changed, 167 insertions, 86 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b00b1e32..8c0a2fe79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-23 Werner Koch <wk@g10code.com>
+
+ * am/cmacros.am (extra_bin_ldflags): New. For W32CE set the stack
+ size to 256k.
+
2010-11-17 Werner Koch <wk@g10code.com>
* configure.ac (ENABLE_CARD_SUPPORT): Define.
diff --git a/NEWS b/NEWS
index 1fd3a1019..e2627fb4a 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ Noteworthy changes in version 2.1.0beta2 (unreleased)
* TMPDIR is now also honored when creating a socket using
--no-standard-socket and with symcryptrun's temp files.
- * Fixed a bug where Scdaemon sends a signal to Gpg-agent running in
+ * Fixed a bug where SCdaemon sends a signal to Gpg-agent running in
non-daemon mode.
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 289b42f6f..17c671965 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-23 Werner Koch <wk@g10code.com>
+
+ * Makefile.am (gpg_agent_LDFLAGS): Add extra_bin_ldflags.
+
2010-11-11 Werner Koch <wk@g10code.com>
* agent.h (opt): Add field SIGUSR2_ENABLED.
diff --git a/agent/Makefile.am b/agent/Makefile.am
index 9c58627e6..b20fdeafc 100644
--- a/agent/Makefile.am
+++ b/agent/Makefile.am
@@ -75,7 +75,7 @@ gpg_agent_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS) $(PTH_CFLAGS)
gpg_agent_LDADD = $(commonpth_libs) \
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(PTH_LIBS) \
$(GPG_ERROR_LIBS) $(LIBINTL) $(NETLIBS) $(LIBICONV)
-gpg_agent_LDFLAGS = $(gpg_agent_res_ldflags)
+gpg_agent_LDFLAGS = $(extra_bin_ldflags) $(gpg_agent_res_ldflags)
gpg_agent_DEPENDENCIES = $(gpg_agent_res_deps)
gpg_protect_tool_SOURCES = \
diff --git a/am/cmacros.am b/am/cmacros.am
index 6668b2558..da34eb7ed 100644
--- a/am/cmacros.am
+++ b/am/cmacros.am
@@ -54,11 +54,15 @@ endif
# Under Windows we use LockFileEx. WindowsCE provides this only on
# the WindowsMobile 6 platform and thus we need to use the coredll6
-# import library.
+# import library. We also want to use a stacksize of 256k instead of
+# the 2MB which is the default with cegcc. 256k is the largest stack
+# we use with pth.
if HAVE_W32CE_SYSTEM
extra_sys_libs = -lcoredll6
+extra_bin_ldflags = -Wl,--stack=0x40000
else
extra_sys_libs =
+extra_bin_ldflags =
endif
diff --git a/common/ChangeLog b/common/ChangeLog
index 88675f5b3..310963067 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-23 Werner Koch <wk@g10code.com>
+
+ * asshelp.c (SECS_TO_WAIT_FOR_AGENT, SECS_TO_WAIT_FOR_DIRMNGR):
+ Use these constants. For W32CE increase them to 30 seconds.
+ (start_new_gpg_agent): Print time to startup agent.
+ (start_new_dirmngr): Ditto.
+
2010-11-04 Werner Koch <wk@g10code.com>
* logging.c (do_logv) [W32]: Don't set a default log stream if the
diff --git a/common/asshelp.c b/common/asshelp.c
index 8e25eb3ea..313d0ddd4 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -42,6 +42,15 @@
# define lock_spawn_t dotlock_t
#endif
+/* The time we wait until the agent or the dirmngr are ready for
+ operation after we started them before giving up. */
+#ifdef HAVE_W32CE_SYSTEM
+# define SECS_TO_WAIT_FOR_AGENT 30
+# define SECS_TO_WAIT_FOR_DIRMNGR 30
+#else
+# define SECS_TO_WAIT_FOR_AGENT 5
+# define SECS_TO_WAIT_FOR_DIRMNGR 5
+#endif
/* A bitfield that specifies the assuan categories to log. This is
identical to the default log handler of libassuan. We need to do
@@ -335,6 +344,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
gpg_error_t err = 0;
char *infostr, *p;
assuan_context_t ctx;
+ int did_success_msg = 0;
*r_ctx = NULL;
@@ -423,16 +433,19 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
if (verbose)
log_info (_("waiting %d seconds for the agent "
- "to come up\n"), 5);
- for (i=0; i < 5; i++)
+ "to come up\n"), SECS_TO_WAIT_FOR_AGENT);
+ for (i=0; i < SECS_TO_WAIT_FOR_AGENT; i++)
{
gnupg_sleep (1);
err = assuan_socket_connect (ctx, sockname, 0, 0);
if (!err)
{
- if (verbose && !debug)
- log_info (_("connection to agent"
- " established\n"));
+ if (verbose)
+ {
+ log_info (_("connection to agent "
+ "established (%ds)\n"), i+1);
+ did_success_msg = 1;
+ }
break;
}
}
@@ -517,7 +530,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
return gpg_err_make (errsource, GPG_ERR_NO_AGENT);
}
- if (debug)
+ if (debug && !did_success_msg)
log_debug (_("connection to agent established\n"));
err = assuan_transact (ctx, "RESET",
@@ -552,6 +565,7 @@ start_new_dirmngr (assuan_context_t *r_ctx,
gpg_error_t err;
assuan_context_t ctx;
const char *sockname;
+ int did_success_msg = 0;
*r_ctx = NULL;
@@ -612,16 +626,19 @@ start_new_dirmngr (assuan_context_t *r_ctx,
if (verbose)
log_info (_("waiting %d seconds for the dirmngr to come up\n"),
- 5);
- for (i=0; i < 5; i++)
+ SECS_TO_WAIT_FOR_DIRMNGR);
+ for (i=0; i < SECS_TO_WAIT_FOR_DIRMNGR; i++)
{
gnupg_sleep (1);
err = assuan_socket_connect (ctx, sockname, 0, 0);
if (!err)
{
- if (verbose && !debug)
- log_info (_("connection to the dirmngr"
- " established\n"));
+ if (verbose)
+ {
+ log_info (_("connection to the dirmngr"
+ " established (%ds)\n"), i+1);
+ did_success_msg = 1;
+ }
break;
}
}
@@ -646,7 +663,7 @@ start_new_dirmngr (assuan_context_t *r_ctx,
return gpg_err_make (errsource, GPG_ERR_NO_DIRMNGR);
}
- if (debug)
+ if (debug && !did_success_msg)
log_debug (_("connection to the dirmngr established\n"));
*r_ctx = ctx;
diff --git a/dirmngr/ChangeLog b/dirmngr/ChangeLog
index d1c768a53..d840ed43f 100644
--- a/dirmngr/ChangeLog
+++ b/dirmngr/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-23 Werner Koch <wk@g10code.com>
+
+ * Makefile.am (dirmngr_LDFLAGS): Add extra_bin_ldflags.
+ (dirmngr_client_LDFLAGS): Ditto.
+
2010-10-21 Werner Koch <wk@g10code.com>
* dirmngr.c (main): Changed faked system time warning
diff --git a/dirmngr/Makefile.am b/dirmngr/Makefile.am
index 7e1ce9df6..5b1fe30be 100644
--- a/dirmngr/Makefile.am
+++ b/dirmngr/Makefile.am
@@ -63,7 +63,7 @@ dirmngr_LDADD = $(libcommonpth) ../gl/libgnu.a $(DNSLIBS) $(LIBASSUAN_LIBS) \
if !USE_LDAPWRAPPER
dirmngr_LDADD += $(LDAPLIBS)
endif
-
+dirmngr_LDFLAGS = $(extra_bin_ldflags)
if USE_LDAPWRAPPER
dirmngr_ldap_SOURCES = dirmngr_ldap.c $(ldap_url)
@@ -76,7 +76,9 @@ endif
dirmngr_client_SOURCES = dirmngr-client.c
dirmngr_client_LDADD = $(libcommon) no-libgcrypt.o \
../gl/libgnu.a $(LIBASSUAN_LIBS) \
- $(GPG_ERROR_LIBS) $(LIBINTL) $(LIBICONV)
+ $(GPG_ERROR_LIBS) $(LIBINTL) \
+ $(LIBICONV)
+dirmngr_client_LDFLAGS = $(extra_bin_ldflags)
no-libgcrypt.c : $(top_srcdir)/tools/no-libgcrypt.c
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 7f3db32b2..ddc9ba0e0 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-23 Werner Koch <wk@g10code.com>
+
+ * Makefile.am (gpg2_LDFLAGS, gpgv2_LDFLAGS): Add extra_bin_ldflags.
+
+ * plaintext.c (handle_plaintext): Change to use estream.
+ s/rc/err/. Replace some xmalloc by xtrymalloc. Use more
+ gpg_strerror.
+ * options.h (struct): Change type of OUTFP to estream_t.
+ * decrypt.c (decrypt_message_fd): Adjust accordingly.
+
2010-11-17 Werner Koch <wk@g10code.com>
* keyedit.c (find_pk_from_sknode): Remove.
diff --git a/g10/Makefile.am b/g10/Makefile.am
index c47de1c1d..c8fc4821e 100644
--- a/g10/Makefile.am
+++ b/g10/Makefile.am
@@ -123,8 +123,10 @@ LDADD = $(needed_libs) ../common/libgpgrl.a \
$(LIBINTL) $(CAPLIBS) $(NETLIBS)
gpg2_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
$(LIBICONV) $(extra_sys_libs)
+gpg2_LDFLAGS = $(extra_bin_ldflags)
gpgv2_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
$(LIBICONV) $(extra_sys_libs)
+gpgv2_LDFLAGS = $(extra_bin_ldflags)
t_common_ldadd =
module_tests = t-rmd160
diff --git a/g10/decrypt.c b/g10/decrypt.c
index 62e12d560..48d5e84f7 100644
--- a/g10/decrypt.c
+++ b/g10/decrypt.c
@@ -135,7 +135,7 @@ decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd)
#warning Need to fix this if we want to use g13
opt.outfp = NULL;
#else
- opt.outfp = fdopen (dup (output_fd), "wb");
+ opt.outfp = es_fdopen_nc (output_fd, "wb");
#endif
if (!opt.outfp)
{
@@ -161,7 +161,7 @@ decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd)
err = proc_encryption_packets (ctrl, NULL, fp );
iobuf_close (fp);
- fclose (opt.outfp);
+ es_fclose (opt.outfp);
opt.outfp = NULL;
release_armor_context (afx);
release_progress_context (pfx);
diff --git a/g10/options.h b/g10/options.h
index b71271da6..28a2805a9 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -43,7 +43,7 @@ struct
unsigned debug;
int armor;
char *outfile;
- FILE *outfp; /* Hack, sometimes used in place of outfile. */
+ estream_t outfp; /* Hack, sometimes used in place of outfile. */
off_t max_output;
int dry_run;
int list_only;
diff --git a/g10/plaintext.c b/g10/plaintext.c
index 1d4c8c793..17f8ea58b 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -49,9 +49,9 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
int nooutput, int clearsig)
{
char *fname = NULL;
- FILE *fp = NULL;
+ estream_t fp = NULL;
static off_t count = 0;
- int rc = 0;
+ int err = 0;
int c;
int convert = (pt->mode == 't' || pt->mode == 'u');
#ifdef __riscos__
@@ -69,7 +69,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
output will be written to it. This is to make sure that no
not-yet-flushed stuff will be written after the plaintext
status message. */
- fflush (stdout);
+ es_fflush (es_stdout);
snprintf (status, sizeof status,
"%X %lu ", (byte) pt->mode, (ulong) pt->timestamp);
@@ -78,7 +78,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
if (!pt->is_partial)
{
- sprintf (status, "%lu", (ulong) pt->len);
+ snprintf (status, sizeof status, "%lu", (ulong) pt->len);
write_status_text (STATUS_PLAINTEXT_LENGTH, status);
}
}
@@ -88,11 +88,21 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
;
else if (opt.outfp)
{
- fname = xstrdup ("[FP]");
+ fname = xtrystrdup ("[FP]");
+ if (!fname)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
}
else if (opt.outfile)
{
- fname = xstrdup (opt.outfile);
+ fname = xtrystrdup (opt.outfile);
+ if (!fname)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
}
else if (pt->namelen == 8 && !memcmp (pt->name, "_CONSOLE", 8))
{
@@ -106,7 +116,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
fname = ask_outfile_name (pt->name, pt->namelen);
if (!fname)
{
- rc = gpg_error (GPG_ERR_GENERAL); /* Can't create file. */
+ err = gpg_error (GPG_ERR_GENERAL); /* Can't create file. */
goto leave;
}
}
@@ -118,17 +128,13 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
else if (opt.outfp)
{
fp = opt.outfp;
-#ifdef HAVE_DOSISH_SYSTEM
- setmode (fileno (fp), O_BINARY);
-#endif
+ es_set_binary (fp);
}
else if (iobuf_is_pipe_filename (fname) || !*fname)
{
/* No filename or "-" given; write to stdout. */
- fp = stdout;
-#ifdef HAVE_DOSISH_SYSTEM
- setmode (fileno (fp), O_BINARY);
-#endif
+ fp = es_stdout;
+ es_set_binary (fp);
}
else
{
@@ -139,7 +145,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
xfree (tmp);
/* FIXME: Below used to be G10ERR_CREATE_FILE */
- rc = gpg_error (GPG_ERR_GENERAL);
+ err = gpg_error (GPG_ERR_GENERAL);
goto leave;
}
xfree (fname);
@@ -148,10 +154,10 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
}
#ifndef __riscos__
- if (opt.outfp && is_secured_file (fileno (opt.outfp)))
+ if (opt.outfp && is_secured_file (es_fileno (opt.outfp)))
{
- rc = gpg_error (GPG_ERR_EPERM);
- log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (rc));
+ err = gpg_error (GPG_ERR_EPERM);
+ log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
goto leave;
}
else if (fp || nooutput)
@@ -159,14 +165,14 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
else if (is_secured_filename (fname))
{
gpg_err_set_errno (EPERM);
- rc = gpg_error_from_syserror ();
- log_error (_("error creating `%s': %s\n"), fname, strerror (errno));
+ err = gpg_error_from_syserror ();
+ log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
goto leave;
}
- else if (!(fp = fopen (fname, "wb")))
+ else if (!(fp = es_fopen (fname, "wb")))
{
- rc = gpg_error_from_syserror ();
- log_error (_("error creating `%s': %s\n"), fname, strerror (errno));
+ err = gpg_error_from_syserror ();
+ log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
goto leave;
}
#else /* __riscos__ */
@@ -182,11 +188,15 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
;
else
{
+ /* Note: riscos stuff is not expected to wrok anymore. If we
+ want to port it again to riscos we should do most of the suff
+ in estream. FIXME: Consider to remove all riscos special
+ cases. */
fp = fopen (fname, "wb");
if (!fp)
{
- log_error (_("error creating `%s': %s\n"), fname, strerror (errno));
- rc = G10ERR_CREATE_FILE;
+ log_error (_("error creating `%s': %s\n"), fname, gpg_strerror (err));
+ err = G10ERR_CREATE_FILE;
if (errno == 106)
log_info ("Do output file and input file have the same name?\n");
goto leave;
@@ -210,7 +220,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
if (clearsig)
{
log_error ("clearsig encountered while not expected\n");
- rc = G10ERR_UNEXPECTED;
+ err = gpg_error (GPG_ERR_UNEXPECTED);
goto leave;
}
@@ -220,7 +230,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
if ((c = iobuf_get (pt->buf)) == -1)
{
- rc = gpg_error_from_syserror ();
+ err = gpg_error_from_syserror ();
log_error ("problem reading source (%u bytes remaining)\n",
(unsigned) pt->len);
goto leave;
@@ -237,17 +247,17 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
- rc = gpg_error (GPG_ERR_TOO_LARGE);
+ err = gpg_error (GPG_ERR_TOO_LARGE);
goto leave;
}
- else if (putc (c, fp) == EOF)
+ else if (es_putc (c, fp) == EOF)
{
- if (ferror (fp))
- rc = gpg_error_from_syserror ();
+ if (es_ferror (fp))
+ err = gpg_error_from_syserror ();
else
- rc = gpg_error (GPG_ERR_EOF);
+ err = gpg_error (GPG_ERR_EOF);
log_error ("error writing to `%s': %s\n",
- fname, strerror (errno));
+ fname, gpg_strerror (err));
goto leave;
}
}
@@ -262,7 +272,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
len = iobuf_read (pt->buf, buffer, len);
if (len == -1)
{
- rc = gpg_error_from_syserror ();
+ err = gpg_error_from_syserror ();
log_error ("problem reading source (%u bytes remaining)\n",
(unsigned) pt->len);
xfree (buffer);
@@ -276,15 +286,15 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
- rc = gpg_error (GPG_ERR_TOO_LARGE);
+ err = gpg_error (GPG_ERR_TOO_LARGE);
xfree (buffer);
goto leave;
}
- else if (fwrite (buffer, 1, len, fp) != len)
+ else if (es_fwrite (buffer, 1, len, fp) != len)
{
- rc = gpg_error_from_syserror ();
+ err = gpg_error_from_syserror ();
log_error ("error writing to `%s': %s\n",
- fname, strerror (errno));
+ fname, gpg_strerror (err));
xfree (buffer);
goto leave;
}
@@ -312,17 +322,17 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("Error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
- rc = gpg_error (GPG_ERR_TOO_LARGE);
+ err = gpg_error (GPG_ERR_TOO_LARGE);
goto leave;
}
- else if (putc (c, fp) == EOF)
+ else if (es_putc (c, fp) == EOF)
{
- if (ferror (fp))
- rc = gpg_error_from_syserror ();
+ if (es_ferror (fp))
+ err = gpg_error_from_syserror ();
else
- rc = gpg_error (GPG_ERR_EOF);
+ err = gpg_error (GPG_ERR_EOF);
log_error ("error writing to `%s': %s\n",
- fname, strerror (errno));
+ fname, gpg_strerror (err));
goto leave;
}
}
@@ -330,9 +340,16 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
}
else
{ /* binary mode */
- byte *buffer = xmalloc (32768);
+ byte *buffer;
int eof_seen = 0;
+ buffer = xtrymalloc (32768);
+ if (!buffer)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
+
while (!eof_seen)
{
/* Why do we check for len < 32768:
@@ -354,16 +371,15 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
- rc = gpg_error (GPG_ERR_TOO_LARGE);
+ err = gpg_error (GPG_ERR_TOO_LARGE);
xfree (buffer);
goto leave;
}
- else if (fwrite (buffer, 1, len, fp) != len)
+ else if (es_fwrite (buffer, 1, len, fp) != len)
{
- rc = (errno ? gpg_error_from_syserror ()
- : gpg_error (GPG_ERR_INTERNAL));
+ err = gpg_error_from_syserror ();
log_error ("error writing to `%s': %s\n",
- fname, strerror (errno));
+ fname, gpg_strerror (err));
xfree (buffer);
goto leave;
}
@@ -385,15 +401,14 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
{
log_error ("error writing to `%s': %s\n",
fname, "exceeded --max-output limit\n");
- rc = gpg_error (GPG_ERR_TOO_LARGE);
+ err = gpg_error (GPG_ERR_TOO_LARGE);
goto leave;
}
- else if (putc (c, fp) == EOF)
+ else if (es_putc (c, fp) == EOF)
{
- rc = (errno ? gpg_error_from_syserror ()
- : gpg_error (GPG_ERR_INTERNAL));
+ err = gpg_error_from_syserror ();
log_error ("error writing to `%s': %s\n",
- fname, strerror (errno));
+ fname, gpg_strerror (err));
goto leave;
}
}
@@ -434,11 +449,10 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
pt->buf = NULL;
}
- if (fp && fp != stdout && fp != opt.outfp && fclose (fp))
+ if (fp && fp != es_stdout && fp != opt.outfp && es_fclose (fp))
{
- rc = (errno ? gpg_error_from_syserror ()
- : gpg_error (GPG_ERR_INTERNAL));
- log_error ("error closing `%s': %s\n", fname, strerror (errno));
+ err = gpg_error_from_syserror ();
+ log_error ("error closing `%s': %s\n", fname, gpg_strerror (err));
fp = NULL;
goto leave;
}
@@ -448,20 +462,21 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
/* Make sure that stdout gets flushed after the plaintext has been
handled. This is for extra security as we do a flush anyway
before checking the signature. */
- if (fflush (stdout))
+ if (es_fflush (es_stdout))
{
/* We need to check the return code to detect errors like disk
full for short plaintexts. See bug#1207. Checking return
values is a good idea in any case. */
- if (!rc)
- rc = gpg_error_from_syserror ();
- log_error ("error flushing `%s': %s\n", "[stdout]", strerror (errno));
+ if (!err)
+ err = gpg_error_from_syserror ();
+ log_error ("error flushing `%s': %s\n", "[stdout]",
+ gpg_strerror (err));
}
- if (fp && fp != stdout && fp != opt.outfp)
- fclose (fp);
+ if (fp && fp != es_stdout && fp != opt.outfp)
+ es_fclose (fp);
xfree (fname);
- return rc;
+ return err;
}
diff --git a/sm/ChangeLog b/sm/ChangeLog
index e10bd3458..b72b333d4 100644
--- a/sm/ChangeLog
+++ b/sm/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-23 Werner Koch <wk@g10code.com>
+
+ * Makefile.am (gpgsm_LDADD): Add extra_bin_ldflags.
+
2010-10-08 Werner Koch <wk@g10code.com>
* gpgsm.c: Add option --with-keygrip.
diff --git a/sm/Makefile.am b/sm/Makefile.am
index 7386debcb..122323dcd 100644
--- a/sm/Makefile.am
+++ b/sm/Makefile.am
@@ -59,6 +59,7 @@ gpgsm_LDADD = $(common_libs) ../common/libgpgrl.a \
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(LIBASSUAN_LIBS) \
$(GPG_ERROR_LIBS) $(LIBREADLINE) $(LIBINTL) $(ZLIBS) \
$(LIBICONV) $(extra_sys_libs)
+gpgsm_LDFLAGS = $(extra_bin_ldflags)
# Make sure that all libs are build before we use them. This is
# important for things like make -j2.
diff --git a/tools/ChangeLog b/tools/ChangeLog
index a2bd9337d..98e2329ca 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-23 Werner Koch <wk@g10code.com>
+
+ * Makefile.am (gpgconf_LDFLAGS): Add extra_bin_ldflags.
+
2010-11-17 Marcus Brinkmann <mb@g10code.com>
* gogconf.c: Revert accidental debug output commit.
diff --git a/tools/Makefile.am b/tools/Makefile.am
index b85d2640b..323e11433 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -96,6 +96,7 @@ gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c no-libgcrypt.c
gpgconf_LDADD = $(maybe_commonpth_libs) $(opt_libassuan_libs) \
$(LIBINTL) $(GPG_ERROR_LIBS) $(PTH_LIBS) $(NETLIBS) \
$(LIBICONV) $(W32SOCKLIBS)
+gpgconf_LDFLAGS = $(extra_bin_ldflags)
gpgparsemail_SOURCES = gpgparsemail.c rfc822parse.c rfc822parse.h
gpgparsemail_LDADD =