Mail Archives: djgpp-workers/2001/08/23/00:57:53
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 -