Bug 170125 - [libc] tcsetpgrp(fd) should fail when fd is a pipe
Summary: [libc] tcsetpgrp(fd) should fail when fd is a pipe
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 6.3-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-25 02:30 UTC by David Korn
Modified: 2017-12-31 22:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Korn 2012-07-25 02:30:11 UTC
The tcgetpgrp() should fail with -1 and should set errno when the file descriptor is a pipe descriptor.  It returns 0.  Note that file descriptors created with socket pair do return -1.  The program below outputs s=0 and errno=0, but it should output s=-1 and errno non-zero.

How-To-Repeat: #include        <unistd.h>
#include        <stdio.h>
#include        <errno.h>
int main(int argc, char *argv[])
{
        int s,pv[2];
        pipe(pv);
        errno = 0;
        s = tcgetpgrp(pv[1]);
        fprintf(stderr,"s=%d errno=%d\n",s,errno);
        return(0);
}
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:02 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped