unofficial mirror of 
 help / color / mirror / Atom feed
* bug#43987: strerror return value
@ 2020-10-14 11:23 Philipp Klaus Krause
  0 siblings, 0 replies; only message in thread
From: Philipp Klaus Krause @ 2020-10-14 11:23 UTC (permalink / raw)
  To: 43987

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

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.


[-- Attachment #2: guile-strerror-const.patch --]
[-- Type: text/x-patch, Size: 886 bytes --]

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);

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

only message in thread, other threads:[~2020-10-14 11:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 11:23 bug#43987: strerror return value Philipp Klaus Krause

unofficial mirror of 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror guile-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-bugs guile-bugs/ \
	public-inbox-index guile-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git