tech-userlevel archive

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

Re: Increase PTHREAD_KEYS_MAX (round 2)

In article <>,
Emmanuel Dreyfus  <> wrote:
>On Wed, May 20, 2015 at 03:11:48PM +0200, Joerg Sonnenberger wrote:
>> >
>> This will just overflow the pthread structure? Besides, use strtoi,
>> calloc etc.
>Here is an updated version using strtoll, calloc and taking care
>of struct __pthread_st integrity:

Looks pretty good, except:

	pthread_keys_max = strtol(pkm, (char **)NULL, 10);

Why cast NULL, why limit to decimal, this should be unsigned...?
Perhaps also limit it to a reasonable value.

	if (pthread__tsd_list)

No need to check for NULL before free.

	pthread_keys_max = 0;

Why default to 0 on error? I would default to the current default.

	long pthread_keys_max = 0;

Why initialize it, why long?


Traditionally we call the bail label out, err is confusing because
it is also a function name.



Home | Main Index | Thread Index | Old Index