From 66043cb41e483354a28705d6cf15b7212afc528c Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Fri, 9 Nov 2001 08:07:18 +0000 Subject: Yet another quotastats fix. --- quotastats.c | 9 ++++++--- 1 file 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 * - * 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 #include #include +#include #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; -- cgit v1.2.3