summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Houston <ghouston@arglist.com>2000-04-04 19:11:58 +0000
committerGary Houston <ghouston@arglist.com>2000-04-04 19:11:58 +0000
commit1de052a72c66a35b3d41da846c0c76d6f946e440 (patch)
treef92314638f0f23a4fd871c1968952be3a27f8d60
parent4260a7fced0ab02e1bb284f11f1e1b645975a713 (diff)
downloadguile-1de052a72c66a35b3d41da846c0c76d6f946e440.tar.gz
* 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).
-rw-r--r--libguile/error.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libguile/error.c b/libguile/error.c
index 679373715..bb5ae8bb8 100644
--- a/libguile/error.c
+++ b/libguile/error.c
@@ -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