From 152af2f5d075ce062e9a578738ad5c32735dd682 Mon Sep 17 00:00:00 2001 From: David Levine Date: Sun, 27 Aug 2017 09:25:21 -0400 Subject: [PATCH] Ensure that mhfixmsg exit status is either 0 or 1. Ralph noticed where exit status values were being accumulated, and those values could include -1. --- uip/mhfixmsg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 34e366ce..fc1b0a6d 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -485,7 +485,10 @@ main (int argc, char **argv) { if (*cts) { for (ctp = cts; *ctp; ++ctp) { - status += mhfixmsgsbr (ctp, maildir, &fx, &infp, outfile, &outfp); + status = + mhfixmsgsbr (ctp, maildir, &fx, &infp, outfile, &outfp) == OK + ? 0 + : 1; free_content (*ctp); if (using_stdin) { @@ -512,7 +515,7 @@ main (int argc, char **argv) { free (folder); free (arguments); - done (status); + done (status == OK ? 0 : 1); return NOTOK; } @@ -2716,7 +2719,7 @@ write_content (CT ct, const char *input_filename, char *outfile, FILE *outfp, } } else { inform("unable to remove input file %s, " - "not modifying it, continuing...", infile); + "not modifying it, continuing...", infile); (void) m_unlink (outfile); status = NOTOK; } -- 2.56.0