NetBSD-Bugs archive

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

kern/39796: sigpending(2) lies about error returns

>Number:         39796
>Category:       kern
>Synopsis:       sigpending(2) lies about error returns
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 24 14:55:00 +0000 2008
>Originator:     Robert Elz
>Release:        NetBSD 4.0_STABLE (NetBSD current of today)
        Prince of Songkla University
System: NetBSD 4.0_STABLE NetBSD 4.0_STABLE 
(JADE-1.696-20080517) #9: Fri May 23 18:55:13 ICT 2008 i386
Architecture: i386
Machine: i386
        sigpending(2) claims ...

     The sigpending function does not currently detect any errors.

        That's not correct.

        See the following test code (ignore the warning about
        the declaration of exit, I forgot to include stdlib.h
        so sue me ...)

NetBSD-current# cat t.c
#include <signal.h>
#include <stdio.h>

        int n;

        n = sigpending((sigset_t *)7);

        if (n != 0)

        printf("sigpending() returned %d\n", n);

NetBSD-current# cc -o t t.c
t.c: In function 'main':
t.c:15: warning: incompatible implicit declaration of built-in function 'exit'
NetBSD-current# ./t
sigpending: Bad address
sigpending() returned -1

        Probably best is to change the sentence to say thyat sigpending
        returns no specific errors (aside from the general ones).

        Alternatively, if you like clutter, you could list EFAULT
        specifically, and then make sure that there are none of the
        other "occurs almost anywhere" errors that are possible.

Home | Main Index | Thread Index | Old Index