Subject: bug#43987: closed (Re: strerror return value)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 03 Nov 2021 18:23:02 +0000

Your bug report

#43987: strerror return value

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
43987: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=43987
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: strerror return value
From: lloda <[email-masked]>
To: [email-masked]
Date: Wed, 3 Nov 2021 19:22:17 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Patch applied in ab9c0c9ca787da60ac9b956fdbcf4c1fa68c3300. Thanks!

Subject: strerror return value
From: Philipp Klaus Krause <[email-masked]>
To: [email-masked]
Date: Wed, 14 Oct 2020 13:23:22 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

This is just a very minor issue.

libguile contains two calls to strerror where the result is used to
initialize a char *. However, according to the strerror specification,
the string returned by strerror should never be changed, so I think it
would be better to use const char * instead.

Philipp
diff --git a/libguile/posix.c b/libguile/posix.c
index 47769003a..5c7bb35bd 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1272,7 +1272,7 @@ renumber_file_descriptor (int fd, int err)
     {
       /* At this point we are in the child process before exec.  We
          cannot safely raise an exception in this environment.  */
-      char *msg = strerror (errno);
+      const char *msg = strerror (errno);
       fprintf (fdopen (err, "a"), "start_child: dup failed: %s\n", msg);
       _exit (127);  /* Use exit status 127, as with other exec errors. */
     }
@@ -1356,7 +1356,7 @@ start_child (const char *exec_file, char **exec_argv,
 
   /* The exec failed!  There is nothing sensible to do.  */
   {
-    char *msg = strerror (errno);
+    const char *msg = strerror (errno);
     fprintf (fdopen (2, "a"), "In execvp of %s: %s\n",
              exec_file, msg);
   }