delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/09/14/06:59:02

Date: Fri, 14 Sep 2001 13:16:09 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp-workers AT delorie DOT com
Message-Id: <8296-Fri14Sep2001131608+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
In-reply-to: <4634-Fri14Sep2001114751+0300-eliz@is.elta.co.il>
Subject: Re: A new W2K problem: djtar
References: <4634-Fri14Sep2001114751+0300-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Fri, 14 Sep 2001 11:47:52 +0300
> From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
> 
> 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?

- Raw text -


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