From: Philipp Klaus Krause <pkk@spth.de>
To: 43987@debbugs.gnu.org
Subject: bug#43987: strerror return value
Date: Wed, 14 Oct 2020 13:23:22 +0200 [thread overview]
Message-ID: <df1eb171-2a28-2bd1-cb69-454980a19461@spth.de> (raw)
[-- 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.
Philipp
[-- 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);
}
next reply other threads:[~2020-10-14 11:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 11:23 Philipp Klaus Krause [this message]
2021-11-03 18:22 ` bug#43987: strerror return value lloda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df1eb171-2a28-2bd1-cb69-454980a19461@spth.de \
--to=pkk@spth.de \
--cc=43987@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).