]> granicus.if.org Git - neomutt/commitdiff
check retval of mutt_save_attachment()
authorRichard Russon <rich@flatcap.org>
Mon, 13 Nov 2017 02:23:25 +0000 (02:23 +0000)
committerRichard Russon <rich@flatcap.org>
Wed, 15 Nov 2017 15:12:11 +0000 (15:12 +0000)
attach.c

index ff9e9f0e97af1a75bbca5d4ad0f61666acbb8652..458803b699cfb1e991f7b937098aa1013846da47 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -751,8 +751,13 @@ static FILE *save_attachment_open(char *path, int flags)
 
 /**
  * mutt_save_attachment - Save an attachment
- * @retval 0 on success
- * @retval -1 on error
+ * @param fp    Source file stream. Can be NULL
+ * @param m     Email Body
+ * @param path  Where to save the attachment
+ * @param flags Flags, e.g. #MUTT_SAVE_APPEND
+ * @param hdr   Message header for the current message. Can be NULL
+ * @retval  0 Success
+ * @retval -1 Error
  */
 int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct Header *hdr)
 {
@@ -1010,8 +1015,8 @@ int mutt_print_attachment(FILE *fp, struct Body *a)
     }
 
     /* in recv mode, save file to newfile first */
-    if (fp)
-      mutt_save_attachment(fp, a, newfile, 0, NULL);
+    if (fp && (mutt_save_attachment(fp, a, newfile, 0, NULL) != 0))
+      return 0;
 
     strfcpy(command, entry->printcommand, sizeof(command));
     piped = rfc1524_expand_command(a, newfile, type, command, sizeof(command));