NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/41094: sigtimedwait returns EAGAIN instead of EINVAL if timeout is invalid
>Number: 41094
>Category: kern
>Synopsis: sigtimedwait returns EAGAIN instead of EINVAL if timeout is
>invalid
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Mar 29 16:15:00 +0000 2009
>Originator: Matteo Beccati
>Release: NetBSD 5.0_RC3
>Organization:
>Environment:
NetBSD epia.hq.beccati.com 5.0_RC3 NetBSD 5.0_RC3 (EPIA) #5: Sun Mar 29
17:17:36 CEST 2009
root%aperol.beccati.com@localhost:/array1/compile/netbsd-5/src/sys/arch/i386/compile/obj/EPIA
i386
>Description:
sigtimedwait returns EAGAIN instead of EINVAL if the specified timeout
overflows when converted in Hz.
From the man page:
sigtimedwait() may also fail if:
[EINVAL] The specified timeout was invalid.
>How-To-Repeat:
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <limits.h>
#include <time.h>
#include <errno.h>
int main(int argc, char **argv)
{
sigset_t mask;
siginfo_t info;
struct timespec ts;
sigemptyset(&mask);
sigaddset(&mask, SIGTERM);
sigprocmask(SIG_BLOCK, &mask, NULL);
ts.tv_sec = LONG_MAX;
ts.tv_nsec = 999;
int ret = sigtimedwait(&mask, &info, &ts);
printf("Ret: %d, Error: %d %s\n", ret, errno, strerror(errno));
return 0;
}
>Fix:
Index: sys/kern/sys_sig.c
===================================================================
RCS file: /cvsroot/src/sys/kern/sys_sig.c,v
retrieving revision 1.17
diff -u -r1.17 sys_sig.c
--- sys/kern/sys_sig.c 15 Oct 2008 06:51:20 -0000 1.17
+++ sys/kern/sys_sig.c 29 Mar 2009 16:10:53 -0000
@@ -640,7 +640,7 @@
if (timo == 0 && ts.tv_sec == 0 && ts.tv_nsec > 0)
timo = 1;
if (timo <= 0)
- return (EAGAIN);
+ return (EINVAL);
/*
* Remember current uptime, it would be used in
Home |
Main Index |
Thread Index |
Old Index