This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


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

1.3.4: read on pipe setting errno=ECHILD



When I upgraded from 1.3.3 to 1.3.4 on W2K, I noticed tcsh's
backquote substitution getting a little "random" (i.e. sometimes it
would work, and sometimes an empty string would be substituted).  I
traced this randomness to the following fragment in tcsh's
sh.glob.c:backeval() routine:

		do
		    icnt = read(pvec[0], tibuf, BUFSIZE);
		while (icnt == -1 && errno == EINTR);
		if (icnt <= 0) {
		    c = -1;
		    break;
		}

The "break" is out of a "gather characters from child process" loop,
so the output of the child process is *sometimes* discarded.  FWICT,
1.3.3 would always set errno=EINTR (I'm assuming that this is
because the parent process receives a SIGCHILD before all of the
data is available to the read).

The above problem could be fixed by changing the "errno == EINTR" to
"(errno == EINTR || errno == ECHILD)", but I can't find any
documentation that a POSIX read() is permitted to set errno to
ECHILD, so I don't think that this change is really justifiable.  I
just may not have access to the correct documentation on what errno
values may be set to by read, so I'll defer judgment to the experts.


Cheers,

Dan 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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