delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/10/18:16:41

From: "Chris Underwood" <underwoodc AT logica DOT nospam DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Corruption of read-only files on program crash
Date: Fri, 10 Dec 1999 16:32:17 -0000
Organization: Logica UK Ltd.
Lines: 51
Message-ID: <82r9uj$4so@romeo.logica.co.uk>
References: <82l8ll$4h2 AT romeo DOT logica DOT co DOT uk> <82o3bs$gnk AT acp3bf DOT knirsch DOT de>
NNTP-Posting-Host: 158.234.18.170
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker wrote in message <82o3bs$gnk AT acp3bf DOT knirsch DOT de>...
>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


It's possible, but extremely unlikely. Not all of the code is mine of
course - there's the third party mp3 player library (Xaudio), which could
potentially be doing nasty things. I've never come across anything like this
before though, and I've been using the Borland compiler (at work) for some
time now.

>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.

This is something which is new to me under DOS. I presume it should also
never take down Windows, since any memory accesses outside my program bounds
should cause a SIGSEGV or similar. It can crash Windows though. In this
case, I don't even think it's the 3rd party mp3 library at fault, because
apparently it was built using DjGPP.

> 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.


Hmm, not sure. I'm familiar with the concept of near and far pointers, but
it sounds like you're talking about something subtly different that I don't
know about here. Could I be using the nearptr you're talking about
inadvertantly?

In time I'll fix all (ok, most) of the bugs, and it won't self-corrupt its
database files anymore. Until then, is there anything I can do to save
myself backing up and restoring the entire project tree lots? It would make
the development a bit easier, and a bit less scary!

By the way, where can I get the Allegro mp3 decoder library from? I'm
thinking of changing over, due to some dubious properties of the one I'm
using.

Chris


- Raw text -


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