Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jul 2012 01:22:12 GMT
From:      David Korn <dgk@research.att.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/170125: tcsetgrp(fd) should fail when fd is a pipe
Message-ID:  <201207250122.q6P1MBBe021515@red.freebsd.org>
Resent-Message-ID: <201207250130.q6P1UBbj016647@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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     root@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207250122.q6P1MBBe021515>