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

Re: 2nd call: binary incompatibility



Cristian Gafton writes:
>On Wed, 17 Sep 1997, Theodore Y. Ts'o wrote:
>> a pointer to a PAM handle, we can process it as if it were an new-style
>> function.  I'd advocate putting a magic number into the PAM structure,
>> to make it easier to tell whether or not we're pointing at a valid PAM
>> structure.
>
>And how would you test that out ? If you do:
>	if (firstarg->magic == magicnumber)
>		blah;
>you already have a race. How do you de-reference a pointer which might not
>be a pointer ?

You test it first by checking to see if it is a small negative number.
*then* you dereference it when you are pretty sure it's a pointer, and
the magic number just makes the test stronger.

But it is possible to catch SIGSEGV and siglongjmp to catch this, too,
as disgusting as that is.

>It's hard to tell wether the first arg is a *pamh after 'if it's not a
>small number', because on some platforms byte ordering can cause some
>problems...

Not if it is coded right.

>Better off cut from the early stage than try to maintain a workaround that
>will be broken at some point in the near future...

But it won't necessarily be broken.

michaelkjohnson

"Magazines all too frequently lead to books and should be regarded by the
 prudent as the heavy petting of literature."            -- Fran Lebowitz




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