delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/03/01:05:01

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: PMCOM
Date: Wed, 02 Jan 2002 22:56:38 -0700
Organization: Systematic Software
Lines: 37
Message-ID: <mkg73u46pcd4kdfeb3r0aoln4u4re94gf4@4ax.com>
References: <20020102130358 DOT 95843 DOT qmail AT web9107 DOT mail DOT yahoo DOT com>
NNTP-Posting-Host: h-207-148-144-79.dial.cadvision.com
Mime-Version: 1.0
X-Trace: news3.cadvision.com 1010037399 4141 207.148.144.79 (3 Jan 2002 05:56:39 GMT)
X-Complaints-To: news AT cadvision DOT com
NNTP-Posting-Date: Thu, 3 Jan 2002 05:56:39 +0000 (UTC)
X-Newsreader: Forte Agent 1.8/32.548
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Wed, 2 Jan 2002 05:03:58 -0800 (PST), ROLAND
<roland_asmann AT yahoo DOT com> wrote:

>First let me wish you all a very good 2002!
>
>I have a question concerning PMCOM, but I cannot get
>in touch with Peter Marinov.
>I have ported a program from UNIX to DJGPP, and I am
>using PMCOM for serial communication.
>Everything is working fine, until at some point the
>program crashes, telling me it could not "read" memory
>at address "0xfffff" (or something like that).
>I am not sure what to do about this, since my program
>calls a COMReadBuffer in a while-loop, and it performs
>this COMReadBuffer several times, with a correct
>result. And then at some point, it just crashes,
>leaving me wondering who to solve this...
>Does anybody know what's wrong here??
>Or could it be the problem is not with the
>COMReadBuffer in the while-loop but some place else??

You're calling something which normally returns a valid pointer,
but returns -1 when there is an error, and you are not checking
for -1 as an error return value: you may be assuming that NULL is
returned on an error. 
This is not always the case, especially when dealing with system
calls. 
If you are already checking for NULL, add a check for || ? == -1
and print out some debugging info for both error cases, to see if
there is a difference in symtoms. 

Thanks. Take care, Brian Inglis 	Calgary, Alberta, Canada
-- 
Brian DOT Inglis AT CSi DOT com 	(Brian dot Inglis at SystematicSw dot ab dot ca)
    fake address		use address above to reply
tosspam AT aol DOT com abuse AT aol DOT com abuse AT yahoo DOT com abuse AT hotmail DOT com abuse AT msn DOT com abuse AT sprint DOT com abuse AT earthlink DOT com abuse AT cadvision DOT com abuse AT ibsystems DOT com uce AT ftc DOT gov
						spam traps

- Raw text -


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