- Fix if_mounted on FreeBSD
authorRoman Bogorodskiy <mirrorbox@users.sourceforge.net>
Sun, 16 Oct 2005 11:53:36 +0000 (11:53 +0000)
committerRoman Bogorodskiy <mirrorbox@users.sourceforge.net>
Sun, 16 Oct 2005 11:53:36 +0000 (11:53 +0000)
- Mention submitter in AUTHORS

Submitted by: Elisey O. Savateev <bio3k at softboard dot ru>

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@347 7f574dfc-610e-0410-a909-a81674777703

AUTHORS
src/conky.c
src/conky.h

diff --git a/AUTHORS b/AUTHORS
index acd7b80..46a9f2e 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -37,6 +37,9 @@ Dennis Frommknecht
 Dennis Kaandorp <addict at quicknet dot nl>
   adt746x stuff
 
+Elisey O. Savateev <bio3k at softboard dot ru>
+  Fixed if_mounted on FreeBSD
+
 Falk Feuersenger <lumberjack at users dot sourceforge dot net>
   I2C divisor from a file
 
index 52445f0..98e8dc7 100644 (file)
@@ -303,6 +303,7 @@ static int blockstart[MAX_IF_BLOCK_DEPTH];
 
 int check_mount(char *s)
 {
+#if defined(__linux__)
        int ret = 0;
        FILE *mtab = fopen("/etc/mtab", "r");
        if (mtab) {
@@ -319,6 +320,17 @@ int check_mount(char *s)
                ERR("Could not open mtab");
        }
        return ret;
+#elif defined(__FreeBSD__)
+       struct statfs *mntbuf;
+       int i, mntsize;
+
+       mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
+       for (i = mntsize - 1; i >= 0; i--)
+               if (strcmp(mntbuf[i].f_mntonname, s) == 0)
+                       return 1;
+
+       return 0;
+#endif
 }
 
 
index 8b3138f..f2e81e0 100644 (file)
 #include <locale.h>
 #include <langinfo.h>
 #include <wchar.h>
+#if defined(__FreeBSD__)
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/ucred.h>
+#endif /* __FreeBSD__ */
 
 #ifdef X11
 #if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)