Mail Archives: djgpp-workers/2001/09/14/18:35:25
> > There seems to be a new problem with W2K: djtar prints error messages
> > about EBADF when run on a .tar.gz archive. I'm trying to debug this.
>
> Okay, I think I understand the problem. Here's the relevant fragment
> from epunzip.c:
>
> if(!should_be_written)
> epoutfile = open("/dev/null",
> O_WRONLY | O_BINARY | O_CREAT | O_EXCL,
> S_IWRITE | S_IREAD);
>
> This fails inside `open', since it sees O_CREAT, decides that the file
> should be created anew, calls __file_exists to see if /dev/null
> exists, and since __file_exists returns non-zero, `open' fails.
>
> This seems like a bug in epunzip.c, doesn't it? Why should it insist
> on creating /dev/null?
>
> OTOH, I don't understand how does it work on other platforms? Oh, I
> see: __file_exists fails for devices on every other platform. Does
> this form of `open' work on GNU/Linux?
It seems we should not be trying to O_CREAT devices, but if that's
common for devices (e.g. > /dev/null) maybe we need to remove the quick
fail logic in open and replace with something that knows about devices.
Depending on a feature of __file_exists (_chmod) failing on devices
seems dangerous. I'll look at it.
- Raw text -