albfan / miraclecast

Connect external monitors to your system via Wifi-Display specification also known as Miracast
Other
3.68k stars 408 forks source link

Use of non-portable strndupa preventing compilation on Musl #448

Closed PureTryOut closed 1 year ago

PureTryOut commented 1 year ago

Hi, I'm trying to get Miraclecast compiled and running for Alpine Linux which means it has to work with Musl and OpenRC. I've already applied #441 locally which helps, but compilation fails on the use of strndupa in https://github.com/albfan/miraclecast/blob/master/src/shared/shl_util.c#L829, which is non-portable and a GNU extension. https://linux.die.net/man/3/strdupa

It would be great if this could be ported away from to something POSIX, so this can be compiled on Musl systems like Alpine Linux.

albfan commented 1 year ago

From https://stackoverflow.com/a/33728005/848072, looks like strdupa freed automatically the memory, so I'm totally ok with a PR wrapping with _GNU_SOURCE or using strdupa and freed at the end.

albfan commented 1 year ago

fixed on b46679d