Patch #2 to Pcomm v1.1
Paul Allen
paula at bcsaic.UUCP
Wed Sep 21 04:44:51 AEST 1988
In article <416 at quintus.UUCP> ok at quintus.UUCP (Richard A. O'Keefe) writes:
>In article <13900004 at osiris.cso.uiuc.edu> hood at 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 at boeing.com
Boeing Advanced Technology Center | ...!uw-beaver!ssc-vax!bcsaic!paula
More information about the Comp.sources.bugs
mailing list