Mail Archives: djgpp-workers/2001/08/22/15:45:01
> > If get_dev_info returns zero and OS is NT, 99% of the time this will
> > be a pipe or weird handle.
>
> I'm not sure we know enough to rely on that. You effectively rely on
> a bug to tell you something very specific about the handle.
Up to this point we have been talking about seeking on STDIN (does the
2.03 library not call the is_executable? fstat() doesn't cause this
problem in 2.03 which might explain why it's more rare).
I tried test >> testout
I tried test >> nul
fstat() is OK with handle 1, in both cases thinks it's a file, lseek
says it's at the beginning (0) wrong for file append. First example
gets the right size in fstat, second example says it is zero length.
Both examples return times (first example is file time, second example
is weird date in future). In both cases _read fails on the handle.
So, what about seeking on outlet handles? It doesn't work, but
the dev_info looks identical.
It seems to me if dev_info is zero for a pre-opended handle on NT we
should be very careful - just modifying magic_num and seek is a partial
fix.
Proposal: fstat() (or dev info?) does the following:
if dev_info == 0 and NT and handlenumb <5 dev_info = 0x8000
So it appears as a char device instead of a file. Only ambigous
for redirect from a floppy, and treating those as a character
device is probably a good optimization :-)
- Raw text -