[oe] [meta-oe][PATCH V2] ledmon: control hard disk led for RAID arrays

Khem Raj raj.khem at gmail.com
Mon Apr 15 14:29:12 UTC 2019


On Mon, Apr 15, 2019 at 4:44 AM Adrian Bunk <bunk at stusta.de> wrote:

> On Tue, Apr 09, 2019 at 09:32:44PM -0700, Khem Raj wrote:
> >...
> > +musl does not support on_exit which is used in clean up.
> > +Instead use atexit with is supported by musl and glibc.
>
> The functions have different signatures, and this patch introduces bugs
> for cases that use the parameters of on_exit.
>
> int on_exit(void (*function)(int , void *), void *arg);
> int atexit(void (*function)(void));
>
> Example:
>
> >...
> > +-    if (on_exit(_ledmon_status, &terminate))
> > ++    if (atexit(_ledmon_status))
> >...
>
> static void _ledmon_status(int status, void *ignore)
> {
>         if (*((int *)ignore) != 0)
>                 log_info("exit status is %s.", strstatus(status));
>         else if (status != STATUS_SUCCESS)
>                 log_error("parent exit status is %s.", strstatus(status));
> }
>
> With the bogus atexit change no parameters are passed to _ledmon_status,
> and the function uses (and dereferenes) whatever garbage is currently
> in the stack/registers where function parameters are expected.


Thanks for looking into it and This is correct somehow I overlooked it i
will send a follow up to not rely on arguments for on_exit

>
>
> cu
> Adrian
>
> --
>
>        "Is there not promise of rain?" Ling Tan asked suddenly out
>         of the darkness. There had been need of rain for many days.
>        "Only a promise," Lao Er said.
>                                        Pearl S. Buck - Dragon Seed
>
>


More information about the Openembedded-devel mailing list