diff options
author | jkar8572 <jkar8572> | 2002-03-27 16:21:26 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2002-03-27 16:21:26 +0000 |
commit | 5975341695e27f23f5a58758954d1ea31c2d0d25 (patch) | |
tree | 5bb3bac1bdc313edffa6552867c8954a5dfeaac7 /quotastats.c | |
parent | a40b9d8688fe0f1f34c70a986d3e408273fed14e (diff) | |
download | linuxquota-5975341695e27f23f5a58758954d1ea31c2d0d25.tar.gz |
Fixed bug in quota(1) return code.
Rewritten detection of kernel version.
Added support for generic interface for both quota formats in kernel.
Diffstat (limited to 'quotastats.c')
-rw-r--r-- | quotastats.c | 7 |
1 files changed, 5 insertions, 2 deletions
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 <mvw@planets.elm.net> * - * 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) { |