timer_create null check for 2nd arg (evp)

Mike Frysinger vapier at gentoo.org
Fri Feb 9 22:11:18 UTC 2007


On Friday 09 February 2007, Kay McCormick wrote:
> In timer_create function in librt (librt/timer_create.c) the second
> argument should be checked for NULL.  I have third-party (commercial)
> code that calls timer_create with evp NULL.  I checked the specs
> available online and this is allowable.

true:
http://www.opengroup.org/onlinepubs/009695399/functions/timer_create.html

> So where it says 
> if (__builtin_expect(evp->sigev_notify == SIGEV_THREAD, 1))
> near the top of the function and file and changed it to
> if (evp != NULL && __builtin_expect(evp->sigev_notify == SIGEV_THREAD,
> 1))

yes and no ... the proper thing would be to implement:
If the evp argument is NULL, the effect is as if the evp argument pointed to a 
sigevent structure with the sigev_notify member having the value 
SIGEV_SIGNAL, the sigev_signo having a default signal number, and the 
sigev_value member having the value of the timer ID.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20070209/cb1ef671/attachment-0002.pgp 


More information about the uClibc mailing list