From: Bruno Haible Date: Sun, 28 Jun 2020 10:26:55 +0000 (+0200) Subject: clean-temp: Fix wrong errno in error message. X-Git-Tag: v1.0~3952 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=01cae8223c3a1920f9746a047dfd5d1e091bf4f1;p=gnulib.git clean-temp: Fix wrong errno in error message. * lib/clean-temp.c (create_temp_dir): Save errno around unblock_fatal_signals call. --- 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;