This is the mail archive of the 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]
Other format: [Raw text]

Re: isatty bug

>* Corinna Vinschen <pbevaan-pltjva@pltjva.pbz> [2003-09-16 12:01:08 +0200]:
> On Mon, Sep 15, 2003 at 05:19:16PM -0400, Sam Steingold wrote:
> > calling isatty(0) in a program results in a segfault:
> And the version number of the DLL is ...


> Fd 0 is a tty, a console window, a tape drive, a ...

I am doing this in a windows console, as created by clicking on the
cygwin icon, i.e., in the bash shell.
I assume that 0 means stdin.

> Reproducible testcase is ...

------- scratch.c ----
#include <stdio.h>
int main (void) {
#define Y_N(x)  ((x) ? "(TTY)" : "(not a TTY)")
  printf("0: %s %s\n1: %s %s\n2: %s %s\n",
#undef Y_N
  return 0;
------- scratch.c ----

$ gdb scratch
GNU gdb 2003-09-02-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run tty
Starting program: /cygdrive/d/sds/c/scratch.exe tty

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? () from
(gdb) where
#0  0x00000000 in ?? () from
(gdb) p isatty(1)
Segmentation fault (core dumped)

same for ttyname(0) &c.

Sam Steingold ( running w2k
<> <> <>
<> <>
Between grand theft and a legal fee, there only stands a law degree.

Unsubscribe info:
Problem reports:

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