Subject: bug#15425: mktemp - conflicting options affected by ENV

From: Pádraig Brady <[email-masked]>
Date: Mon, 07 Oct 2013 12:22:30 +0100

On 10/06/2013 06:10 PM, Pádraig Brady wrote:
> Also I matched the -q option up with the documentation.
> The documented functionality made sense, which was to
> suppress only I/O errors, but the existing code suppressed
> almost all errors, including most usage errors.
> So I fixed that up in a second patch.

I was caught out by inconsistent exit() handling in this area,
which required this follow up commit.

commit cba81e7b84f27385e254cddd065bb16c98a5d045
Author: Pádraig Brady <[email-masked]>
Date:   Mon Oct 7 11:59:53 2013 +0100

    mktemp: fix incorrect exit status from previous commit

    * src/mktemp.c (main): Use an exit() strategy consistent with the
    previous clauses dealing with optional error messages to ensure
    we exit with the correct status in all cases.
    Prompted by the continuous integration build failure at:
    http://hydra.nixos.org/build/6412979

diff --git a/src/mktemp.c b/src/mktemp.c
index 05530a3..074676f 100644
--- a/src/mktemp.c
+++ b/src/mktemp.c
@@ -335,7 +335,8 @@ main (int argc, char **argv)
           int saved_errno = errno;
           remove (dest_name);
           if (!suppress_file_err)
-            error (EXIT_FAILURE, saved_errno, _("write error"));
+            error (0, saved_errno, _("write error"));
+          status = EXIT_FAILURE;
         }
     }