From 01cae8223c3a1920f9746a047dfd5d1e091bf4f1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 28 Jun 2020 12:26:55 +0200 Subject: [PATCH] clean-temp: Fix wrong errno in error message. * lib/clean-temp.c (create_temp_dir): Save errno around unblock_fatal_signals call. --- ChangeLog | 6 ++++++ lib/clean-temp.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 12dadaaa36..0bfeb44f21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-06-28 Bruno Haible + + clean-temp: Fix wrong errno in error message. + * lib/clean-temp.c (create_temp_dir): Save errno around + unblock_fatal_signals call. + 2020-06-27 Bruno Haible fatal-signal: Make multithread-safe. diff --git a/lib/clean-temp.c b/lib/clean-temp.c index b9badac748..e56428cd5f 100644 --- a/lib/clean-temp.c +++ b/lib/clean-temp.c @@ -332,6 +332,7 @@ create_temp_dir (const char *prefix, const char *parentdir, } block_fatal_signals (); tmpdirname = mkdtemp (xtemplate); + int saved_errno = errno; if (tmpdirname != NULL) { tmpdir->dirname = tmpdirname; @@ -340,7 +341,7 @@ create_temp_dir (const char *prefix, const char *parentdir, unblock_fatal_signals (); if (tmpdirname == NULL) { - error (0, errno, + error (0, saved_errno, _("cannot create a temporary directory using template \"%s\""), xtemplate); goto quit; -- 2.39.5