diff options
author | Sebastian Geiger <[email protected]> | 2018-05-26 17:27:07 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-01-28 12:49:25 +0100 |
commit | 3b5b33a095f1064970cf33dd6530fd0721fb4982 (patch) | |
tree | 9cab22e3b5b7001ea074e109a4c95682f5151edf | |
parent | 151311f55461d756965139edb92d536adf14154f (diff) | |
download | mate-applets-3b5b33a095f1064970cf33dd6530fd0721fb4982.tar.bz2 mate-applets-3b5b33a095f1064970cf33dd6530fd0721fb4982.tar.xz |
multiload: ignore priviledged mount points
fixes https://github.com/mate-desktop/mate-applets/issues/230
origin commit:
https://gitlab.gnome.org/GNOME/gnome-applets/commit/daadbbc
-rw-r--r-- | multiload/linux-proc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/multiload/linux-proc.c b/multiload/linux-proc.c index 0e4624d6..fcd48bff 100644 --- a/multiload/linux-proc.c +++ b/multiload/linux-proc.c @@ -1,6 +1,7 @@ /* From wmload.c, v0.9.2, licensed under the GPL. */ #include <config.h> #include <sys/types.h> +#include <sys/statvfs.h> #include <math.h> #include <fcntl.h> #include <unistd.h> @@ -119,6 +120,7 @@ GetDiskLoad (int Maximum, int data [3], LoadGraph *g) for (i = 0; i < mountlist.number; i++) { + struct statvfs statresult; glibtop_fsusage fsusage; if (strcmp(mountentries[i].type, "smbfs") == 0 @@ -126,6 +128,13 @@ GetDiskLoad (int Maximum, int data [3], LoadGraph *g) || strcmp(mountentries[i].type, "cifs") == 0) continue; + if (statvfs (mountentries[i].mountdir, &statresult) < 0) + { + g_debug ("Failed to get statistics for mount entry: %s. Reason: %s. Skipping entry.", + mountentries[i].mountdir, strerror(errno)); + continue; + } + glibtop_get_fsusage(&fsusage, mountentries[i].mountdir); read += fsusage.read; write += fsusage.write; } |