summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-11-09 08:07:18 +0000
committerjkar8572 <jkar8572>2001-11-09 08:07:18 +0000
commit66043cb41e483354a28705d6cf15b7212afc528c (patch)
treeb8036440b55e034f603c8546eb800be6bec81b65
parentaa77462747260f3a79cab65d2e75f33129caae2d (diff)
Yet another quotastats fix.
-rw-r--r--quotastats.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/quotastats.c b/quotastats.c
index 1879b6d..8130989 100644
--- a/quotastats.c
+++ b/quotastats.c
@@ -10,7 +10,7 @@
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
- * Version: $Id: quotastats.c,v 1.7 2001/11/08 23:56:11 jkar8572 Exp $
+ * Version: $Id: quotastats.c,v 1.8 2001/11/09 08:07:18 jkar8572 Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <errno.h>
#include <string.h>
+#include <signal.h>
#include "pot.h"
#include "common.h"
@@ -43,6 +44,7 @@ static inline int get_stats(struct util_dqstats *dqstats)
FILE *f;
int ret = -1;
+ signal(SIGSEGV, SIG_IGN); /* Ignore SIGSEGV due to bad quotactl() */
if ((f = fopen(QSTAT_FILE, "r"))) {
if (fscanf(f, "Version %u", &dqstats->version) != 1) {
errstr(_("Can't parse quota version.\n"));
@@ -59,14 +61,14 @@ static inline int get_stats(struct util_dqstats *dqstats)
goto out;
}
}
- else if (quotactl(QCMD(Q_V1_GETSTATS, 0), "/dev/null", 0, (caddr_t)&old_dqstats) >= 0) {
+ else if (quotactl(QCMD(Q_V1_GETSTATS, 0), NULL, 0, (caddr_t)&old_dqstats) >= 0) {
/* Structures are currently the same */
memcpy(dqstats, &old_dqstats, sizeof(old_dqstats));
dqstats->version = 0;
}
else {
/* Sadly these all are possible to get from kernel :( */
- if (errno != EINVAL && errno != ENOTBLK && errno != EPERM) {
+ if (errno != EINVAL && errno != EPERM && errno != EFAULT) {
errstr(_("Error while getting quota statistics from kernel: %s\n"), strerror(errno));
goto out;
}
@@ -78,6 +80,7 @@ static inline int get_stats(struct util_dqstats *dqstats)
}
ret = 0;
out:
+ signal(SIGSEGV, SIG_DFL);
if (f)
fclose(f);
return ret;