Commit daadbbcd authored by Sebastian Geiger's avatar Sebastian Geiger
Browse files

multiload: ignore priviledged mount points

This patch skips mount points for which
the user has no access permissions.

Fixes #1
parent 207cf8e7
/* 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,14 @@ 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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment