Re: [PATCH kvmtool 1/2] Get basename() from <libgen.h> for musl compat

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

 



On Sat, Jul 27, 2024 at 10:11:14AM GMT, J. Neuschäfer wrote:
> According to the manpage, basename is defined in <libgen.h>.
> Not including it results in a compilation failure on musl-libc:

That's not quite what the man page says — there are two versions of
basename, the POSIX version and the GNU version, with differing
behaviour.

> vfio/core.c:538:22: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
>   538 |         group_name = basename(group_path);
>       |                      ^~~~~~~~

In this case, it should be safe to switch to the POSIX version, because
group_path is writeable and not used after this, so

Reviewed-by: Alyssa Ross <hi@xxxxxxxxx>

but it would be nicer if the commit message was clearer, because it
currently reads like it's just including a missing header, rather than
changing the behaviour of the function.

> Signed-off-by: J. Neuschäfer <j.neuschaefer@xxxxxxx>
> ---
>  vfio/core.c | 1 +
>  1 file changed, 1 insertion(+)

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux