delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/23/00:57:53

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10108230453.AA14434@clio.rice.edu>
Subject: _creat* diffs
To: djgpp-workers AT delorie DOT com (DJGPP developers)
Date: Wed, 22 Aug 2001 23:53:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

I did some quick testing on the reversal of close/open and open/close
and I didn't see any ill effects.  Here are the proposed diffs:

*** _creat.c_	Wed Aug 22 23:53:50 2001
--- _creat.c	Wed Aug 22 23:50:56 2001
*************** _creat(const char* filename, int attrib)
*** 61,66 ****
--- 61,75 ----
      errno = __doserr_to_errno(r.x.ax);
      return -1;
    }
+   if(use_lfn && _osmajor == 5 && _get_dos_version(1) == 0x532) {
+     /* Windows 2000 or XP; or NT with LFN TSR.  Windows 2000 behaves
+        badly when using IOCTL and write-truncate calls on LFN handles.
+        We close the long name file and re-open it with _open.c (short)
+        to work around the bugs. */
+     rv = _open(filename,2);
+     _close(r.x.ax);
+     return rv;
+   }
    __file_handle_set(r.x.ax, O_BINARY);
    return r.x.ax;
  }


*** _creat_n.c_	Wed Aug 22 23:54:10 2001
--- _creat_n.c	Wed Aug 22 23:51:16 2001
*************** _creatnew(const char* filename, int attr
*** 67,72 ****
--- 67,81 ----
      errno = __doserr_to_errno(r.x.ax);
      return -1;
    }
+   if(use_lfn && _osmajor == 5 && _get_dos_version(1) == 0x532) {
+     /* Windows 2000 or XP; or NT with LFN TSR.  Windows 2000 behaves
+        badly when using IOCTL and write-truncate calls on LFN handles.
+        We close the long name file and re-open it with _open.c (short)
+        to work around the bugs. */
+     rv = _open(filename, flags | 2);
+     _close(r.x.ax);
+     return rv;
+   }
    __file_handle_set(r.x.ax, O_BINARY);
    return r.x.ax;
  }

- Raw text -


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