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)
>Organization:
        Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 4.0_STABLE NetBSD 4.0_STABLE 
(JADE-1.696-20080517) #9: Fri May 23 18:55:13 ICT 2008 
kre%jade.coe.psu.ac.th@localhost:/usr/obj/4/kernels/JADE i386
Architecture: i386
Machine: i386
>Description:
        sigpending(2) claims ...

ERRORS
     The sigpending function does not currently detect any errors.

        That's not correct.

>How-To-Repeat:
        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>

main()
{
        int n;

        n = sigpending((sigset_t *)7);

        if (n != 0)
                perror("sigpending");

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

        exit(0);
}
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
NetBSD-current# 

>Fix:
        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