1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +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:
Gary Houston 2000-04-04 19:11:58 +00:00
parent 4260a7fced
commit 1de052a72c

View file

@ -128,7 +128,7 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0,
SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
(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
{
SCM_VALIDATE_INUM (1,err);
@ -140,11 +140,13 @@ SCM_SYMBOL (scm_system_error_key, "system-error");
void
scm_syserror (const char *subr)
{
int save_errno = errno;
scm_error (scm_system_error_key,
subr,
"~A",
scm_cons (scm_makfrom0str (strerror (errno)), SCM_EOL),
scm_cons (SCM_MAKINUM (errno), SCM_EOL));
scm_cons (scm_makfrom0str (strerror (save_errno)), SCM_EOL),
scm_cons (SCM_MAKINUM (save_errno), SCM_EOL));
}
void