void-packages/srcpkgs/bluez/patches/basename.patch

59 lines
1.2 KiB
Diff
Raw Normal View History

2024-06-15 08:34:09 +02:00
--- a/mesh/rpl.c
+++ b/mesh/rpl.c
@@ -33,6 +33,17 @@
static const char *rpl_dir = "/rpl";
+char *
+xbasename(const char *filename)
+{
+#ifdef __GLIBC__
+ return basename(filename);
+#else
+ char *p = strrchr (filename, '/');
+ return p ? p + 1 : (char *) filename;
+#endif
+}
+
bool rpl_put_entry(struct mesh_node *node, uint16_t src, uint32_t iv_index,
uint32_t seq)
{
@@ -146,7 +157,7 @@ static void get_entries(const char *iv_p
if (!dir)
return;
- iv_txt = basename(iv_path);
+ iv_txt = xbasename(iv_path);
if (sscanf(iv_txt, "%08x", &iv_index) != 1) {
closedir(dir);
return;
--- a/tools/hex2hcd.c
+++ b/tools/hex2hcd.c
@@ -25,6 +25,17 @@
#include <stdbool.h>
#include <sys/stat.h>
+char *
+xbasename(const char *filename)
+{
+#ifdef __GLIBC__
+ return basename(filename);
+#else
+ char *p = strrchr (filename, '/');
+ return p ? p + 1 : (char *) filename;
+#endif
+}
+
static ssize_t process_record(int fd, const char *line, uint16_t *upper_addr)
{
const char *ptr = line + 1;
@@ -302,7 +313,7 @@ static void ver_parse_entry(const char *
}
if (S_ISREG(st.st_mode)) {
- ver_parse_file(basename(pathname));
+ ver_parse_file(xbasename(pathname));
goto done;
}