summaryrefslogtreecommitdiff
path: root/multiload
diff options
context:
space:
mode:
authorSebastian Geiger <[email protected]>2018-05-26 17:27:07 +0200
committerraveit65 <[email protected]>2019-01-28 12:42:44 +0100
commit26b05baf2bc752f84f5f9179c3d8345f5a545fec (patch)
tree5bc8172c11b1c25874721950e2b51dfbb5148deb /multiload
parent3d7ff9242cb09151b3476a9b8717edbf71d09546 (diff)
downloadmate-applets-26b05baf2bc752f84f5f9179c3d8345f5a545fec.tar.bz2
mate-applets-26b05baf2bc752f84f5f9179c3d8345f5a545fec.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
Diffstat (limited to 'multiload')
-rw-r--r--multiload/linux-proc.c9
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;
}