Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src



Module Name:    src
Committed By:   riastradh
Date:           Fri Dec 19 04:41:02 UTC 2025

Modified Files:
        src/sys/kern: sys_sig.c
        src/tests/lib/libc/sys: t_sigtimedwait.c

Log Message:
sigtimedwait(2): Return EINTR, not zero, if interrupted.

sigtimedwait(2) should never return zero: zero is not a valid signal
number, and sigtimedwait(2) is only supposed to return a valid signal
number (one of the signals in the input set) or -1.

Previously, if there was a timeout and the call was interrupted with
ERESTART/EINTR for a signal other than one we're waiting for, the
logic would call copyout to update the timeout -- and overwrite the
error code we were supposed to return (ERESTART/EINTR) with the error
code of copyout, even if copyout succeeds, leading the syscall to
return the zero-initialized value of ksi.ksi_signo.  This also had
the effect of completely neutering the ERESTART logic: instead of
restarting, it would just return 0.

Now we overwrite the error code only if copyout fails.

PR standards/59586: sigwaitinfo() returns ECANCELED instead of EINTR
- POSIX compliance violation


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/kern/sys_sig.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_sigtimedwait.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index