From 5975341695e27f23f5a58758954d1ea31c2d0d25 Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Wed, 27 Mar 2002 16:21:26 +0000 Subject: Fixed bug in quota(1) return code. Rewritten detection of kernel version. Added support for generic interface for both quota formats in kernel. --- quotastats.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'quotastats.c') diff --git a/quotastats.c b/quotastats.c index 8130989..b3f0d02 100644 --- a/quotastats.c +++ b/quotastats.c @@ -10,7 +10,7 @@ * * Author: Marco van Wieringen * - * Version: $Id: quotastats.c,v 1.8 2001/11/09 08:07:18 jkar8572 Exp $ + * Version: $Id: quotastats.c,v 1.9 2002/03/27 16:21:26 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 @@ -41,12 +41,13 @@ static inline int get_stats(struct util_dqstats *dqstats) { struct v1_dqstats old_dqstats; struct v2_dqstats v0_dqstats; + char tmp[1024]; 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) { + if (fscanf(f, "Version %u\n", &dqstats->version) != 1) { errstr(_("Can't parse quota version.\n")); goto out; } @@ -54,6 +55,8 @@ static inline int get_stats(struct util_dqstats *dqstats) errstr(_("Kernel quota version %u is too new.\n"), dqstats->version); goto out; } + if (dqstats->version >= 6*10000+5*100+1) + fgets(tmp, sizeof(tmp), f); /* Skip formats information */ if (fscanf(f, "%u %u %u %u %u %u %u %u", &dqstats->lookups, &dqstats->drops, &dqstats->reads, &dqstats->writes, &dqstats->cache_hits, &dqstats->allocated_dquots, &dqstats->free_dquots, &dqstats->syncs) != 8) { -- cgit v1.2.1