Subject: Bug in b18?: lseek( 0, 0, SEEK_CUR ) returns EBADF
From: [email-masked] (Peter F. Caswell)

24 Jan 1998 00:14:15 -0800
Message-ID: <v0310280eb0ed5934e651.cygnus.gnu-win32@[209.6.31.81]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: [email-masked]

I'm trying to use tcl v8.0 to get timers and interactive I/O working at the
same time. To do that, I'm stealing a trick from tk and setting up a
channel handler for stdin.

Well, when you call Tcl_GetDefaultStdChannel( TCL_STDIN ), the file
tclUnixChan.c calls "lseek(0, (off_t)0, SEEK_CUR)" and checks for a failure
with EBADF. I assume that this is there to check if stdin (fileno 0) really
is open.

Well, lseek is returning -1, and errno is set to EBADF. Yet, if I call
fstat(0,...), this works fine. Obviously the file is there, but lseek is
getting confused. Is it simply setting the wrong errno.

I haven't pulled the sources for the library across, so I don't know what
the lseek code is doing.

I'm also having some problems getting further stuff to work with the
background processing. It seems like select is swallowing the first
character typed. But I haven't tracked this down yet.

-pfc

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".