From f1c82f55b9ac75e6bb965c7e9c26668db2b02a2e Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 7 Sep 2004 00:06:18 +0000 Subject: [PATCH] (scm_nice): Correction to error detection. Reported by Matthias Koeppe. --- libguile/posix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libguile/posix.c b/libguile/posix.c index d9cfb529c..35f61037e 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1422,7 +1422,11 @@ SCM_DEFINE (scm_nice, "nice", 1, 0, 0, "The return value is unspecified.") #define FUNC_NAME s_scm_nice { - if (nice (scm_to_int (incr)) != 0) + /* nice() returns "prio-NZERO" on success or -1 on error, but -1 can arise + from "prio-NZERO", so an error must be detected from errno changed */ + errno = 0; + nice (scm_to_int (incr)); + if (errno != 0) SCM_SYSERROR; return SCM_UNSPECIFIED; }