Re: [RESEND PATCH] libpci: sysfs: Fix segmentation fault by including libgen.h

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

 



On Mon May 27, 2024 at 2:33 PM CEST, Martin Mareš wrote:
> Hello!
>
> > On a musl-based system (Alpine-linux) the basename(3) function is not defined
> > by including string.h with _GNU_SOURCE defined. However basename(3) could be
> > defined by including libgen.h.
> > 
> > On musl this is a problem than can lead to a segmentation fault, as I have
> > experienced. This issue is caused by basename(3) function being implicitly
> > declared and thus having, implicitly, a return type of int. Which in my case
> > caused an erroneous sign extension of a pointer leading to a segmentation
> > fault.
> > 
> > Adding an include for libgen.h sound to me like a proper solution.
> > Also by doing so the `_GNU_SOURCE` defined is no longer needed.
>
> It should be fixed by commit 89cb2ae87236604b0e8ededd0fd7d9425c2d8cb6.
>
> Could you please check if it works for you?
nitpick / for the record:
it previously compiled with musl, gcc (13) only generated a warning,
but it should nolonger compile with gcc 14, as the warning is now an error.






[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux