bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] getpass echoes on many systems


From: Paul Eggert
Subject: Re: [Bug-gnulib] getpass echoes on many systems
Date: 01 Oct 2003 21:18:46 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

address@hidden (Larry Jones) writes:

> > There are a few other issues with gnulib getpass.c.  The "if (in !=
> > stdin)" should be "if (in == out)".
> 
> Given the code in getpass, they are synonymous.  Unless, of course,
> it's possible that stdin == stderr.  Or that a newly-opened stream would
> compare equal to stdin.  I think the former is slightly more likely than
> the latter, but I don't think either is actually valid.

But I don't see anywhere where the C or POSIX standards prohibit fopen
from returning stdin.  If they do prohibit it, then Solaris doesn't
conform, as the following program exits with status 1 on Solaris 9
sparc (32-bit):

   #include <stdio.h>
   int main (void)
   {
     fclose (stdin);
     return fopen ("/dev/null", "r") == stdin;
   }

I just searched Dejanews on this topic, and discovered that Perl
formerly assumed that fopen returns stdin in the above situation.
(That is the traditional behavior of fopen, but it's not a portable
assumption either.)  See:

David J Flander
Re: warn/die don't use new STDERR (Linux specific?) (1998-08-25)
http://groups.google.com/groups?selm=199808251213.IAA25256%40mks.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]