From: Thomas Roessler Date: Wed, 11 Dec 2002 22:47:57 +0000 (+0000) Subject: Fix #1417; thanks to Derek D. Martin for the X-Git-Tag: mutt-1-5-3-rel~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73e26da332af486345187f6b9764e42454b675d8;p=mutt Fix #1417; thanks to Derek D. Martin for the excellent observation. (In addition to the fix proper, some tracking of temporary files is added to mutt's debugging output.) --- diff --git a/muttlib.c b/muttlib.c index 41f1c0e7..ca66fd42 100644 --- a/muttlib.c +++ b/muttlib.c @@ -182,7 +182,13 @@ void mutt_free_body (BODY **p) if (b->parameter) mutt_free_parameter (&b->parameter); if (b->unlink && b->filename) + { + dprint (1, (debugfile, "mutt_free_body: Unlinking %s.\n", b->filename)); unlink (b->filename); + } + else if (b->filename) + dprint (1, (debugfile, "mutt_free_body: Not unlinking %s.\n", b->filename)); + FREE (&b->filename); FREE (&b->content); FREE (&b->xtype); @@ -672,9 +678,10 @@ void mutt_free_envelope (ENVELOPE **p) FREE (p); } -void mutt_mktemp (char *s) +void _mutt_mktemp (char *s, const char *src, int line) { snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getpid (), Counter++); + dprint (1, (debugfile, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s)); unlink (s); } diff --git a/pgp.c b/pgp.c index a2540f00..8aa6a007 100644 --- a/pgp.c +++ b/pgp.c @@ -1346,7 +1346,7 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) } unlink (pgperrfile); - + if ((thepid = pgp_invoke_traditional (&pgpin, NULL, NULL, -1, fileno (pgpout), fileno (pgperr), pgpinfile, keylist, flags)) == -1) diff --git a/protos.h b/protos.h index 2aa8032f..809a20ba 100644 --- a/protos.h +++ b/protos.h @@ -193,7 +193,8 @@ void mutt_make_help (char *, size_t, char *, int, int); void mutt_make_misc_reply_headers (ENVELOPE *env, CONTEXT *ctx, HEADER *cur, ENVELOPE *curenv); void mutt_make_post_indent (CONTEXT *ctx, HEADER *cur, FILE *out); void mutt_message_to_7bit (BODY *, FILE *); -void mutt_mktemp (char *); +#define mutt_mktemp(a) _mutt_mktemp (a, __FILE__, __LINE__) +void _mutt_mktemp (char *, const char *, int); void mutt_normalize_time (struct tm *); void mutt_paddstr (int, const char *); void mutt_parse_mime_message (CONTEXT *ctx, HEADER *); diff --git a/send.c b/send.c index 6fff3462..2f618f34 100644 --- a/send.c +++ b/send.c @@ -1039,6 +1039,7 @@ ci_send_message (int flags, /* send mode */ BODY *pbody; int i, killfrom = 0; int fcc_error = 0; + int free_clear_content = 0; #if defined(HAVE_PGP) || defined(HAVE_SMIME) BODY *save_content = NULL; @@ -1491,6 +1492,12 @@ main_loop: * - something else. In this case, it's the same as clear_content. */ + /* This is ugly -- lack of "reporting back" from mutt_protect(). */ + + if (clear_content && (msg->content != clear_content) + && (msg->content->parts != clear_content)) + free_clear_content = 1; + #endif /* HAVE_PGP */ if (!option (OPTNOCURSES) && !(flags & SENDMAILX)) @@ -1651,11 +1658,10 @@ full_fcc: #if defined(HAVE_PGP) || defined(HAVE_SMIME) if (msg->security & ENCRYPT) - { - /* cleanup structures from the first encryption */ - mutt_free_body (&clear_content); FREE (&pgpkeylist); - } + + if (free_clear_content) + mutt_free_body (&clear_content); #endif if (flags & SENDREPLY)