mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 23:50:19 +02:00
* error.c (scm_syserror): save errno before doing anything else,
since it's used in two expressions and may get mutated (thanks to Dirk Herrmann).
This commit is contained in:
parent
4260a7fced
commit
1de052a72c
1 changed files with 5 additions and 3 deletions
|
@ -128,7 +128,7 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
|
SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
|
||||||
(SCM err),
|
(SCM err),
|
||||||
"Returns the Unix error message corresponding to @var{errno}, an integer.")
|
"Returns the Unix error message corresponding to @var{err}, an integer.")
|
||||||
#define FUNC_NAME s_scm_strerror
|
#define FUNC_NAME s_scm_strerror
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_INUM (1,err);
|
SCM_VALIDATE_INUM (1,err);
|
||||||
|
@ -140,11 +140,13 @@ SCM_SYMBOL (scm_system_error_key, "system-error");
|
||||||
void
|
void
|
||||||
scm_syserror (const char *subr)
|
scm_syserror (const char *subr)
|
||||||
{
|
{
|
||||||
|
int save_errno = errno;
|
||||||
|
|
||||||
scm_error (scm_system_error_key,
|
scm_error (scm_system_error_key,
|
||||||
subr,
|
subr,
|
||||||
"~A",
|
"~A",
|
||||||
scm_cons (scm_makfrom0str (strerror (errno)), SCM_EOL),
|
scm_cons (scm_makfrom0str (strerror (save_errno)), SCM_EOL),
|
||||||
scm_cons (SCM_MAKINUM (errno), SCM_EOL));
|
scm_cons (SCM_MAKINUM (save_errno), SCM_EOL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue