NetBSD-Bugs archive

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

kern/45545: pipe2's return value is wrong

>Number:         45545
>Category:       kern
>Synopsis:       pipe2's return value is wrong
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 31 14:35:00 +0000 2011
>Originator:     Yui NARUSE
>Release:        5.99.56 i386
NetBSD 5.99.56 NetBSD 5.99.56 (GENERIC) #0: Thu Sep 29 12:55:50 
JST 2011 i386
pipe2(2)'s returns the fd number of read one.
Run following program and get the output "ret:3, errno:0 3/4".
It should be "ret:0, errno:0 3/4.

#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>

int main(void) {
    int fields[2];
    int ret;
    errno = 0;
    ret = pipe2(fields, 0);
    fprintf(stderr, "ret:%d, errno:%d %d/%d\n",ret,errno,fields[0], fields[1]);
    return 0;

Home | Main Index | Thread Index | Old Index