Skip to content

Commit 3b5b33a

Browse files
lanoxxraveit65
authored andcommitted
multiload: ignore priviledged mount points
fixes #230 origin commit: https://gitlab.gnome.org/GNOME/gnome-applets/commit/daadbbc
1 parent 151311f commit 3b5b33a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

multiload/linux-proc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* From wmload.c, v0.9.2, licensed under the GPL. */
22
#include <config.h>
33
#include <sys/types.h>
4+
#include <sys/statvfs.h>
45
#include <math.h>
56
#include <fcntl.h>
67
#include <unistd.h>
@@ -119,13 +120,21 @@ GetDiskLoad (int Maximum, int data [3], LoadGraph *g)
119120

120121
for (i = 0; i < mountlist.number; i++)
121122
{
123+
struct statvfs statresult;
122124
glibtop_fsusage fsusage;
123125

124126
if (strcmp(mountentries[i].type, "smbfs") == 0
125127
|| strcmp(mountentries[i].type, "nfs") == 0
126128
|| strcmp(mountentries[i].type, "cifs") == 0)
127129
continue;
128130

131+
if (statvfs (mountentries[i].mountdir, &statresult) < 0)
132+
{
133+
g_debug ("Failed to get statistics for mount entry: %s. Reason: %s. Skipping entry.",
134+
mountentries[i].mountdir, strerror(errno));
135+
continue;
136+
}
137+
129138
glibtop_get_fsusage(&fsusage, mountentries[i].mountdir);
130139
read += fsusage.read; write += fsusage.write;
131140
}

0 commit comments

Comments
 (0)