standards/171572: ptsname(-1) returns errno 0

Ed Maste emaste at FreeBSD.org
Wed Sep 12 13:30:02 UTC 2012


>Number:         171572
>Category:       standards
>Synopsis:       ptsname(-1) returns errno 0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 12 13:30:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Ed Maste
>Release:        FreeBSD 9.0-STABLE i386
>Organization:
FreeBSD
>Environment:
System: FreeBSD freefall.freebsd.org 9.0-STABLE FreeBSD 9.0-STABLE #6 r235139: Tue May 8 21:19:03 UTC 2012 simon at freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386

>Description:

ptsname(fildes) is documented to set errno to EBADF if fildes is not a
valid open file descriptor, but ptsname(-1) returns errno = 0.

>How-To-Repeat:

==[test-ptsname.c]==
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	char *name;

	errno = 0;
	name = ptsname(-1);
	printf("ptsname(-1) returns %p (%s), errno is %d\n", name,
	    name ? name : "", errno);
}
====

[emaste at freefall ~]$ ./test-ptsname 
ptsname(-1) returns 0x0 (), errno is 0

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-standards mailing list