delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/09/08:27:41

From: broeker AT acp3bf DOT knirsch DOT de (Hans-Bernhard Broeker)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Corruption of read-only files on program crash
Date: 9 Dec 1999 12:21:32 +0100
Organization: RWTH Aachen, III. physikalisches Institut B
Lines: 25
Message-ID: <82o3bs$gnk@acp3bf.knirsch.de>
References: <82l8ll$4h2 AT romeo DOT logica DOT co DOT uk>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 944738497 9004 137.226.32.75 (9 Dec 1999 11:21:37 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 9 Dec 1999 11:21:37 GMT
X-Newsreader: TIN [version 1.2 PL2]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Chris Underwood (underwoodc AT logica DOT nospam DOT com) wrote:
[...]
> When the program crashes, it occasionally destroyes the text
> files it happens to have open, either replacing them with a series of
> repeating bytes or blanking them completely.
[...]

As Nate and Eli already pointed out, your program just may be
corrupting the disk cache. OTOH, even that alone shouldn't effect the
data on the disk, yet, for a file opened in readonly mode (DOS/Windows
*does* distinguish between open for read and open for write, doesn't
it?) Not unless your program by extremely bad luck manages to modify
the internal data structures of the cache without corrupting them,
thus turning read-only cache contents into write-behind, 'dirty'
content that has to be written back to disk.

Another thing to keep in mind: off the shelf, a DJGPP program wouldn't
normally be able to commit this kind of trespass, due to the memory
protection offered by protected mode. Does your program use the
nearptr method, by any chance? If so, stop doing that, and the problem
might just go away... nearptr *is* fundamentally unsafe, after all.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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