Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] logic error with code hosted on your servers



On Sun, 14 Mar 2004 02:00:54 -0800 (PST), mohr@example.com wrote:

> I reviewed the source and tracked the error down to misc.c in the server/
> directory.  On line 255 it is stated:
> 
> if ((context = RkwInitialize( (char *)ddname )) < 0)
> 
> As you can see, this comparison will always fail, causing the program to
> exit prematurely (giving an extremely nondescript error).  This line
> should read:
> 
> if ((context == RkwInitialize( (char *)ddname )) < 0)
> 
> Which will perform the comparison correctly and allow the server to run.

The original makes sense in C, your modification doesn't.

The original means: "Assign RkwInitialize( (char *)ddname ) to context and
if the value assigned was less than zero (remember, char is signed in C)
then...."

What you wrote means "Compare RkwInitialize( (char *)ddname ) to context,
and if the result of the conmparison is negative (which doesn't make sense)
then..."

Not to mention that the variable "context" may be used elsewhere either
locally in the function or globally in the application, and your
modification no longer assigns the result of RkwInitialize() to it.

Believe me, the problem is elsewhere, and I strongly urge you to reestablish
the original code if you don't want inexplicable errors cropping up from
time to time.

-- 
G. Stewart   --   gstewart@example.com -- gstewart@example.com
Registered Linux user #284683 (Slackware 9.0, Linux 2.4.25)
--------------------------------------------------------------
genius, n:
        A chemist who discovers a laundry additive that rhymes with
        "bright".

Attachment: pgp00071.pgp
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links