>Number:         170125
>Category:       kern
>Synopsis:       tcsetgrp(fd) should fail when fd is a pipe
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 25 01:30:11 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     David Korn
>Release:        6.3-RELEASE-p13
>Organization:
AT&T
>Environment:
FreeBSD chud00.research.att.com 6.3-RELEASE-p13 FreeBSD 6.3-RELEASE-p13 #0: Thu 
Oct  1 22:30:50 UTC 2009     
r...@i386-builder.daemonology.net:/usr/obj/usr/src/sys/SMP i386 i386 i386 
FreeBSD

>Description:
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);
}
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to