shithub: riscv

Download patch

ref: 200c18bc150a896752a1f84eabbbf13e3ee150a6
parent: 55d8082842367540b7c3918253c04f71fc9361bb
author: Alex Musolino <[email protected]>
date: Mon Jun 22 12:34:31 EDT 2020

upas/marshal: make attachment failure fatal

--- a/sys/src/cmd/upas/marshal/marshal.c
+++ b/sys/src/cmd/upas/marshal/marshal.c
@@ -136,6 +136,7 @@
 char *login;
 Alias *aliases;
 int rfc822syntaxerror;
+int attachfailed;
 char lastchar;
 char *replymsg;
 
@@ -308,6 +309,10 @@
 		holding = holdon();
 		headersrv = readheaders(&in, &flags, &hdrstring,
 			eightflag? &to: nil, eightflag? &cc: nil, eightflag? &bcc: nil, l, 1);
+		if(attachfailed){
+			Bdrain(&in);
+			fatal("attachment(s) failed, message not sent");
+		}
 		if(rfc822syntaxerror){
 			Bdrain(&in);
 			fatal("rfc822 syntax error, message not sent");
@@ -501,8 +506,11 @@
 				if(att == nil)
 					break;
 				*att = mkattach(hdrval(s_to_c(sline)), nil, hdrtype == Hinclude);
-				if(*att != nil)
-					att = &(*att)->next;
+				if(*att == nil){
+					attachfailed = 1;
+					return Error;
+				}
+				att = &(*att)->next;
 				break;
 			}
 			s_free(sline);