From 58723e026a91ace37d9871dd9fb277a4a1e7434e Mon Sep 17 00:00:00 2001 From: Michael Gran Date: Fri, 9 Jun 2023 13:06:41 -0700 Subject: [PATCH] Check return value of nice 'nice' is marked as 'warn_unused_result' on some versions of Ubuntu which causes make distcheck to fail. This implements the error checking logic exactly as POSIX suggests to silence the warning. * libguile/posix.c (scm_nice): new error checking logic. --- libguile/posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libguile/posix.c b/libguile/posix.c index 4564cb33b..4ca8d5ff7 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -2137,8 +2137,8 @@ SCM_DEFINE (scm_nice, "nice", 1, 0, 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) + int prio = nice (scm_to_int (incr)); + if (prio == -1 && errno != 0) SCM_SYSERROR; return SCM_UNSPECIFIED;