libweston,tools: Include libgen.h for basename signature
Latest musl has removed the declaration from string.h [1] as it only implements POSIX version alone and string.h in glibc implements GNU version of basename. This now results in compile errors on musl. This might be a warning with older compilers but it is error with Clang-17+ as it treats -Wimplicit-function-declaration as error Switch the use in backlight_init function to use POSIX version [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
336f7fabec
commit
dbd134ca5a
|
@ -41,6 +41,7 @@
|
||||||
#include <drm.h>
|
#include <drm.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -167,7 +168,7 @@ struct backlight *backlight_init(struct udev_device *drm_device,
|
||||||
DIR *backlights = NULL;
|
DIR *backlights = NULL;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
enum backlight_type type = 0;
|
enum backlight_type type = 0;
|
||||||
char buffer[100];
|
char buffer[100], basename_buffer[100];
|
||||||
struct backlight *backlight = NULL;
|
struct backlight *backlight = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -186,9 +187,10 @@ struct backlight *backlight_init(struct udev_device *drm_device,
|
||||||
free(path);
|
free(path);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
strncpy(basename_buffer, buffer, ret);
|
||||||
buffer[ret] = '\0';
|
buffer[ret] = '\0';
|
||||||
pci_name = basename(buffer);
|
basename_buffer[ret] = '\0';
|
||||||
|
pci_name = basename(basename_buffer);
|
||||||
|
|
||||||
if (connector_type <= 0)
|
if (connector_type <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
Loading…
Reference in New Issue