mirror of
https://github.com/troglobit/finit.git
synced 2026-11-20 19:41:51 +00:00
Fix compilation on musl by using posix basename
This commit is contained in:
1 parent
06adecaaea
commit
72ebc92622
3 files changed
+7
-2
No files matched your search
@@ -26,6 +26,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <sys/inotify.h>
|
#include <sys/inotify.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#ifdef _LIBITE_LITE
|
#ifdef _LIBITE_LITE
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -28,6 +28,7 @@
|
|||||||
#include <dirent.h> /* readdir() et al */
|
#include <dirent.h> /* readdir() et al */
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <libgen.h>
|
||||||
#ifdef _LIBITE_LITE
|
#ifdef _LIBITE_LITE
|
||||||
# include <libite/lite.h>
|
# include <libite/lite.h>
|
||||||
# include <libite/queue.h> /* BSD sys/queue.h API */
|
# include <libite/queue.h> /* BSD sys/queue.h API */
|
||||||
@@ -86,9 +87,11 @@ int plugin_register(plugin_t *plugin)
|
|||||||
if (!plugin->name) {
|
if (!plugin->name) {
|
||||||
#ifndef ENABLE_STATIC
|
#ifndef ENABLE_STATIC
|
||||||
Dl_info info;
|
Dl_info info;
|
||||||
|
char *dli_fname = strdup(info.dli_fname);
|
||||||
|
|
||||||
if (dladdr(plugin, &info) && info.dli_fname)
|
if (dladdr(plugin, &info) && dli_fname)
|
||||||
plugin->name = basename(info.dli_fname);
|
plugin->name = basename(dli_fname);
|
||||||
|
free(dli_fname);
|
||||||
#endif
|
#endif
|
||||||
if (!plugin->name)
|
if (!plugin->name)
|
||||||
plugin->name = "unknown";
|
plugin->name = "unknown";
|
||||||
|
|||||||
Reference in new issue
Block a user