delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/09/16/15:22:50

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: eos.vss.fsi.com: ford owned process doing -bs
Date: Tue, 16 Sep 2003 14:22:33 -0500 (CDT)
From: Brian Ford <ford AT vss DOT fsi DOT com>
X-X-Sender: ford AT eos
To: cygwin AT cygwin DOT com
Subject: Re: isatty bug
Message-ID: <Pine.GSO.4.56.0309161419290.685@eos>
MIME-Version: 1.0

Was that stock Cygwin gdb that crashed?

Try this:

$ cat stest.c
#include <sys/types.h>
#include <sys/stat.h>

int same_tty_p (int fd1, int fd2)
{
  struct stat stat1, stat2;

  return (fstat(fd1, &stat1) >= 0 && fstat(fd2, &stat2) >= 0 &&
          stat1.st_dev == stat2.st_dev && stat2.st_ino == stat2.st_ino);
}

int main(void)
{
  printf("0/1: %d\n1/2: %d\n2/0: %d\n",same_tty_p(0,1),
         same_tty_p(1,2),same_tty_p(2,0));
  printf("stat %d bytes\n", sizeof(struct stat));
}

ford AT fordpc ~
$ gcc -o stest stest.c

ford AT fordpc ~
$ ./stest
0/1: 1
1/2: 1
2/0: 1
stat 96 bytes

$ nm stest.exe | grep fstat
00402970 T __fstat64
004060a4 I __imp___fstat64
004060e0 I __imp__fstat
004027a0 T _fstat

Make sure struct stat is 96 bytes and you are calling fstat64.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019