This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3] Add cancellation regression test for getpwuid_r.
On 12/08/2016 07:13 PM, Carlos O'Donell wrote:
> On 12/08/2016 02:02 PM, Mike Frysinger wrote:
>> On 08 Dec 2016 12:15, Carlos O'Donell wrote:
>>> +static void *
>>> +worker( void *arg )
>>
>> seems like this test case is mingling code from diff sources since it has
>> diff styles. there's a number of non-GNU style errors in it -- this is
>> just the first one i saw.
>
> I started with an uncontributed internal Red Hat reproducer, but all that
> was left by the time I was done was a few lines, which you're right, have
> all the wrong style.
>
>>> +{
>>> + int ret;
>>> + unsigned int iter = 0;
>>> + struct passwd pwbuf, *pw;
>>> + uid_t uid;
>>> + uid = geteuid();
>>> + /* Use a reasonable sized buffer. Note that _SC_GETPW_R_SIZE_MAX is
>>> + just a hint and not any kind of maximum value. */
>>> + wbufsz = sysconf(_SC_GETPW_R_SIZE_MAX);
>>> + if (wbufsz == -1)
>>> + wbufsz = 1024;
>>> + wbuf = xmalloc (wbufsz);
>>> + pthread_cleanup_push (worker_free, wbuf);
>>> + sem_post (&started);
>>> + while (1)
>>
>> this func could do with a few newlines sprinkled around. it's pretty
>> dense to read as-is. actually the whole testcase is written this way :).
>>
>>> + printf ("INFO: Previoulsy we would never get here\n");
>>
>> "Previously"
>>
>>> + printf ("PASS: Cancelled getpwuid_r successfully"
>>
>> "Canceled"
>> -mike
>>
>
> v3
> - Fix two spelling mistakes.
> - Fix GNU Coding Style violations.
> - Add more whitespace to make the test more readable.
I believe v3 addresses Florian and Mike's review.
I'll commit this next week if nobody objects.
--
Cheers,
Carlos.