Mail Archives: djgpp-workers/2001/08/04/19:14:16
> > It's not a Bash issue, it's an issue with one of our library functions
> > called when we redirect output: some of them fail on Windows 2000 when
> > the target is the null device (or maybe any device they emulate for
> > DOS).
>
> In particular, open on /dev/null fails using O_TRUNC
In this case we attempt a write to the device of 0 bytes. This
write fails with dos error code of 5 = Access denied.
It appears to me the easiest fix for this is in open.c, which has a
section which looks like:
if ((oflag & O_TRUNC) && !should_create)
if (_write(fd, 0, 0) < 0)
return -1;
would be to ignore the return code from _write in this case:
if ((oflag & O_TRUNC) && !should_create)
_write(fd, 0, 0);
Comments? Can anyone think of a real case we would expect a write of 0
bytes to fail and we would want that to be fatal to the open? The
handle is open and allocated...
- Raw text -