Path: utzoo!attcan!uunet!wyse!vsi1!ames!ll-xn!mit-eddie!uw-beaver!ssc-vax!bcsaic!paula
From: paula@bcsaic.UUCP (Paul Allen)
Newsgroups: comp.sources.bugs
Subject: Re: Patch #2 to Pcomm v1.1
Message-ID: <7782@bcsaic.UUCP>
Date: 20 Sep 88 18:44:51 GMT
References: <13900004@osiris.cso.uiuc.edu> <416@quintus.UUCP>
Reply-To: paula@bcsaic.UUCP (Paul Allen)
Organization: Boeing Computer Services AI Center, Seattle
Lines: 24

In article <416@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>In article <13900004@osiris.cso.uiuc.edu> hood@osiris.cso.uiuc.edu writes:
>>This patch will fix the problem that some people are having with 
>>seqmentation faults (although I'm not convinced the problem isn't
>>in their compiler).
>
>It isn't.  It's the famous *NULL bug.
>
>>! 	if (*lock_path != NULL && lock_path != NULL) {
>
>This only tests whether lock_path is legal *after* trying to use it!

I've now seen a couple postings about this bug, but nobody has got it
right yet!  What has been missed is that C makes no guarantee about the
order of expression evaluation.  The only safe way to perform this test
is using two nested if statements.

I'll be quiet now.
Paul

-- 
------------------------------------------------------------------------
Paul L. Allen                       | paula@boeing.com
Boeing Advanced Technology Center   | ...!uw-beaver!ssc-vax!bcsaic!paula