bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* clean-temp: fix wrong errno in error message
@ 2020-06-28 13:48 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2020-06-28 13:48 UTC (permalink / raw)
  To: bug-gnulib

A simple fix.


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.

diff --git a/lib/clean-temp.c b/lib/clean-temp.c
index b9badac..e56428c 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;



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-28 13:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 13:48 clean-temp: fix wrong errno in error message Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).