commit 60b9b76b466ad62a9f64f2eb7557a2563bbbf683
parent 4363f9347e9bbf8fdfaa4d61f8b4a01c66abb50e
Author: falkTX <falktx@falktx.com>
Date: Mon, 7 Feb 2022 22:22:42 +0000
Only use <mntent.h> on Linux
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/distrho/extra/sofd/libsofd.c b/distrho/extra/sofd/libsofd.c
@@ -338,7 +338,6 @@ const char *x_fib_recent_file(const char *appname) {
}
#ifdef HAVE_X11
-#include <mntent.h>
#include <dirent.h>
#include <X11/Xlib.h>
@@ -347,6 +346,11 @@ const char *x_fib_recent_file(const char *appname) {
#include <X11/keysym.h>
#include <X11/Xos.h>
+#if defined(__linux__) || defined(__linux)
+#define HAVE_MNTENT
+#include <mntent.h>
+#endif
+
#ifndef MIN
#define MIN(A,B) ( (A) < (B) ? (A) : (B) )
#endif
@@ -1766,6 +1770,7 @@ static int parse_gtk_bookmarks (Display *dpy, const char *fn) {
return found;
}
+#ifdef HAVE_MNTENT
static const char *ignore_mountpoints[] = {
"/bin", "/boot", "/dev", "/etc",
"/lib", "/live", "/mnt", "/opt",
@@ -1840,6 +1845,7 @@ static int read_mtab (Display *dpy, const char *mtab) {
fclose (mt);
return found;
}
+#endif
static void populate_places (Display *dpy) {
char tmp[1024];
@@ -1868,9 +1874,11 @@ static void populate_places (Display *dpy) {
parse_gtk_bookmarks (dpy, _fib_cfg_custom_places);
}
+#ifdef HAVE_MNTENT
if (read_mtab (dpy, "/proc/mounts") < 1) {
read_mtab (dpy, "/etc/mtab");
}
+#endif
int parsed_bookmarks = 0;
if (!parsed_bookmarks && getenv ("HOME")) {