www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/08/08:37:19

Date: Thu, 8 Apr 1999 14:34:34 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Michel de Ruiter <Michel AT smr DOT nl>
cc: "'DJGPP workers'" <djgpp-workers AT delorie DOT com>
Subject: RE: fflush question
In-Reply-To: <B0FEA00E82A7D1118BFB00A0CC990278213248@ARGON>
Message-ID: <Pine.SUN.3.91.990408142758.12956C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 8 Apr 1999, Michel de Ruiter wrote:

> > DOS/Windows do this as well--mostly.  The problem you bumped into is a
> > very subtle case:
> 
> Which is why nobody encountered it as a problem, I guess.

I did ;-).  When I was porting Tar, I found out that a feature whereby 
Tar detects that somebody is trying to put the archive being created into 
the archive itself doesn't work, because it was relying on the inode 
number.  Now, you might know that in plain DOS the inode returned by the 
DJGPP implementation of `fstat' is the starting cluster number of the 
file.  The problem: an empty file doesn't have any clusters allocated, so 
its inode is not the real one.  The solution: write a few bytes to the 
file and fsync the handle, before calling `fstat'.

> BTW, should fflush be corrected for this bug, as DJ suggested?

I don't know.  I asked Alain Magloire about a related issue in another 
thread (the one about fflush(stdin)).  I also asked people to try your 
test program on Unix and see if it works on all its flavors.  I want to 
see the answers before I make up my mind, and I hope others will tell 
what they think as well.

- Raw text -


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