Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  8 Apr 1999 00:33:22 -0700 (PDT)
From:      mam@werries.de
To:        freebsd-gnats-submit@freebsd.org
Subject:   kern/11020: popen does not honor ISO 9899 syntax
Message-ID:  <19990408073322.36CE115909@hub.freebsd.org>

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

>Number:         11020
>Category:       kern
>Synopsis:       popen does not honor ISO 9899 syntax
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr  8 00:40:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Michael A. Meiszl
>Release:        3.10
>Organization:
MEC GmbH
>Environment:
FreeBSD mam48.werries.de 3.1-RELEASE FreeBSD 3.1-RELEASE #6: Tue Mar 30 10:26:27
 CEST 1999     root@mam48.werries.de:/usr/src/sys/compile/MAM  i386

>Description:
the popen() library function does not recognize the optional "b" parameter of the type argument (eg "rb" or "wb"). This is in contrast to the fopen() function. For portability this should be handled equal i think.
>How-To-Repeat:
popen ("/bin/ls","rb")

>Fix:
Use the same argument logic as in fopen()
 The mode string can also include the letter ``b'' either as a third character or as a character between the characters in any of the two-charac ter strings described above.  This is strictly for compatibility with ISO 9899: 1990 (``ISO C'') and has no effect; the ``b'' is ignored.

popen.c:
/*
 * Lite2 introduced two-way popen() pipes using socketpair().
 * FreeBSD's pipe() is bidirectional, so we use that.
 */
if (strchr(type, '+')) {
        twoway = 1;
        type = "r+";
} else  {
        twoway = 0;
        if ((*type != 'r' && *type != 'w') || type[1])
                return (NULL);

omit the "|| type[1]" clause


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


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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