]> Savannah Git Hosting - gnulib.git/commitdiff
clean-temp: Fix wrong errno in error message.
authorBruno Haible <bruno@clisp.org>
Sun, 28 Jun 2020 10:26:55 +0000 (12:26 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 28 Jun 2020 13:45:10 +0000 (15:45 +0200)
* lib/clean-temp.c (create_temp_dir): Save errno around
unblock_fatal_signals call.

ChangeLog
lib/clean-temp.c

index 12dadaaa368c9ec27f1f9617637ca3469efb0eb2..0bfeb44f219fd1411b39a0095b91e1755c81d1cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-06-28  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        fatal-signal: Make multithread-safe.
index b9badac748da55cf394a6779035bdc720169a263..e56428cd5fd415587764f26b1d672e751b840736 100644 (file)
@@ -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;