This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: S_ISCHR, S_ISFIFO, O_NONBLOCK, O_NOCTTY


On Thu, 4 Feb 1999 16:32:47 -0800, "Melissa O'Neill" wrote:
>Zack Weinberg <zack@rabi.columbia.edu> writes:
>> Either way, that's gonna hit the "not a file, pipe, or tty" case.  Can
>> you do `cat | ./cpp' on a nextstep box to confirm this?
>
>Running `cat | ./cpp' on my NEXTSTEP 3.3 machine appears to work. Similarly:
>
>	nextstep3.3% echo 'FOO' | ./cpp -DFOO=BAR
>	# 1 ""
>	BAR
>
>... seems right to me (obtained with GNU CPP version egcs-2.93.04 19990131).

The only way I can see for this to happen is if S_IFREG is zero, in
which case a socket will be erroneously detected as a file.  Since
st_size would be zero, that should send the reader into an
infinite loop.

What is the actual value of S_IFREG?  Also, it sounds silly but can
you please verify that ./cpp is cpplib-based?

>On a tangent about fstat bugs and calling shutdown(), I wrote:
>>> With socket fstat bugs in NEXTSTEP and Solaris it was easier just to
>>> call shutdown and ignore any ENOTSOCK errors.
>
>... to which Zack replied:
>> Hmm...  That's not a bad way to detect a socket when you only care
>> about reading, which describes cpplib pretty well.  My documentation
>> is inconsistent - what does shutdown do when asked to disallow sends
>> and sending is already shutdown?
[...]
>On my NEXTSTEP machine, using AF_INET sockets, the second call succeeds
>and appears to be harmlessly redundant.

Was the socket in question connected to anything?

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]