On Tue, Sep 16, 2003 at 02:16:05PM -0400, Sam Steingold wrote: >what about this: > >int same_tty_p (int fd1, int fd2) >{ > struct stat stat1; > struct stat stat2; > return ((fstat(fd1,&stat1) >= 0) && (fstat(fd2,&stat2) >= 0) && > (stat1.st_dev == stat2.st_dev) && (stat2.st_ino == stat2.st_ino)); >} > > > 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)); > > >I get crash both in program and gdb (i.e., gdb itself segfaults) on the >fstat() calls.
Is it really that hard to produce working test cases that compile out of the box? Anyway, after adding a main and some include files the above, unsurprisingly, works fine. cgf -- 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/