Log error on statvfs failure.

When doing stat on a FS and failing, log the error message based
on the errno set to help the user find the reason.
https://bugzilla.gnome.org/show_bug.cgi?id=685172
This commit is contained in:
Robert Roth
2013-12-09 01:57:01 +02:00
parent 2506662196
commit 3147bf2e34

View File

@@ -15,6 +15,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h>
#include <mntent.h> #include <mntent.h>
@@ -197,7 +198,7 @@ glibtop_get_fsusage_s(glibtop *server, glibtop_fsusage *buf, const char *path)
memset(buf, 0, sizeof(glibtop_fsusage)); memset(buf, 0, sizeof(glibtop_fsusage));
if (statvfs(path, &fsd) < 0) { if (statvfs(path, &fsd) < 0) {
glibtop_warn_r(server, "statvfs '%s' failed", path); glibtop_warn_r(server, "statvfs '%s' failed: %s", path, strerror (errno));
return; return;
} }