From: Thomas Roessler Date: Fri, 28 Aug 1998 00:58:25 +0000 (+0000) Subject: [patch-0.94.4i.tlr.get_attachment.1-2] Get the attachment X-Git-Tag: mutt-0-94-5i-rel~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18fa8b3cee846a5df29f7c664b9b906cc13c4bd2;p=mutt [patch-0.94.4i.tlr.get_attachment.1-2] Get the attachment time stamping business right. --- diff --git a/attach.c b/attach.c index 275ec3d3..5492d61a 100644 --- a/attach.c +++ b/attach.c @@ -46,6 +46,7 @@ int mutt_get_tmp_attachment (BODY *a) char tempfile[_POSIX_PATH_MAX]; rfc1524_entry *entry = rfc1524_new_entry(); FILE *fpin = NULL, *fpout = NULL; + struct stat st; if(a->unlink) return 0; @@ -56,6 +57,9 @@ int mutt_get_tmp_attachment (BODY *a) tempfile, sizeof(tempfile)); rfc1524_free_entry(&entry); + + if(stat(a->filename, &st) == -1) + return -1; if((fpin = fopen(a->filename, "r")) && (fpout = safe_fopen(tempfile, "w"))) { @@ -63,6 +67,9 @@ int mutt_get_tmp_attachment (BODY *a) FREE(&a->filename); a->filename = safe_strdup(tempfile); a->unlink = 1; + + if(a->stamp >= st.st_mtime) + mutt_stamp_attachment(a); } else mutt_perror(fpin ? tempfile : a->filename);