delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/26/17:44:42

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10108262123.AA03260@clio.rice.edu>
Subject: Re: fstat patch for redirected char handles (NT/W2K/XP)
To: eliz AT is DOT elta DOT co DOT il
Date: Sun, 26 Aug 2001 16:23:58 -0500 (CDT)
Cc: acottrel AT ihug DOT com DOT au, djgpp-workers AT delorie DOT com
In-Reply-To: <3405-Sun26Aug2001184448+0300-eliz@is.elta.co.il> from "Eli Zaretskii" at Aug 26, 2001 06:44:49 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

I re-worked the fstat patch.  Please comment on new version.  This fixes 
problem of fstat failing with -1 on pre-opened redirected device handles.
Example: stdin if prog < nul, stdout if prog > nul.
The old version had an ugly goto, unneeded call when dev_info was 
already in a variable, and actually missed some cases using
various SFT flags.  If we don't have trusted values at this point we will
fail below unless it's a device.

*** fstat.c_	Fri Aug 17 19:40:32 2001
--- fstat.c	Sun Aug 26 16:17:58 2001
*************** fstat_assist(int fhandle, struct stat *s
*** 423,428 ****
--- 423,431 ----
  	is_remote = 1;
        else
  	is_remote = 0;
+       
+       if(!have_trusted_values && dev_info == 0 && _get_dos_version(1) == 0x532)
+         is_dev = 1;   /* Device under NT or Win2K with pre-open/lfn handle. */
      }
  
    /* First, fill the fields which are constant under DOS. */

- Raw text -


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