$NetBSD: patch-ac,v 1.6 2016/08/15 12:02:37 maya Exp $ write_index() uses bodysum, call it only after calculating it. otherwise the initial value of 0 is used. PR pkg/18422. --- distribute.c.orig 2016-08-15 10:57:27.530046718 +0000 +++ distribute.c @@ -49,7 +49,8 @@ #define index strchr #endif -#if defined(__bsdi__) /* may be wrong -- we need to use NET/2 def.*/ +/* may be wrong -- we need to use NET/2 def.*/ +#if defined(__bsdi__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) # include /* for sendmail path */ #endif @@ -1541,15 +1542,6 @@ send_message() */ putc('\n', pipe); - /* If message have not reject, then write index here. (since we - * have subject information here! -- We assume here that sendmail - * will not fork shell(in this case, archive) before closing pipe. - * so archive will run AFTER we correctly wrote index. - */ - if (reject == 0) { - write_index(); /* write out index if succeed */ - } - /* Dump the message thru the pipe. We push out the header(leader), * then the message body, then the footer. */ @@ -1570,6 +1562,15 @@ send_message() } } + /* If message have not reject, then write index here. (since we + * have subject information here! -- We assume here that sendmail + * will not fork shell(in this case, archive) before closing pipe. + * so archive will run AFTER we correctly wrote index. + */ + if (reject == 0) { + write_index(); /* write out index if succeed */ + } + /* clean-up */