Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 11 Aug 2011 22:47:25 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: cluts daily reports 8/12 - continuing pthread_eintr,
 still stuck with alloc

On Fri, Aug 12, 2011 at 04:45:58AM +0200, Luka Marčetić wrote:
> static void 
> child_wait_vp(void* foo)
> {
>     child_wait();
>     ++foo; // -Wunused-parameter
>     return;
> }

This is invalid C. You cannot do arithmetic on void pointers. I would
really recommend -Wno-unused-parameter, as unused parameters are NOT a
sign of bad code, but a fundamental part of using function pointers.

> /**
>  ** Executes a function whose pointer was passed to it, before exitting
>  ** \param fun a void pointer to the function to execute, or NULL for none
>  **/
> static void* thread(void *fun)
> {
>     if(fun != NULL) {
>         pthread_cleanup_push(child_wait_vp, NULL);
>     }
>     return NULL;
> }

pthread_cleanup_push and pthread_cleanup_pop must come in pairs that
would be valid if they were replaced by { and }. You can't use one
alone.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.