1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

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.
This commit is contained in:
Michael Gran 2023-06-09 13:06:41 -07:00
parent a0805cc274
commit 58723e026a

View file

@ -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 /* 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 */ from "prio-NZERO", so an error must be detected from errno changed */
errno = 0; errno = 0;
nice (scm_to_int (incr)); int prio = nice (scm_to_int (incr));
if (errno != 0) if (prio == -1 && errno != 0)
SCM_SYSERROR; SCM_SYSERROR;
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;