summaryrefslogtreecommitdiff
path: root/quotasys.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-09-25 15:56:59 +0000
committerjkar8572 <jkar8572>2001-09-25 15:56:59 +0000
commit48448ca24e00e530e59d774bfdb3c2a76616330c (patch)
treee4d9c17dbb086945bfa1acc59e5d0bba1156f211 /quotasys.c
parentd9b70c744b212ede06d4487e134c9aaca084e037 (diff)
repquota now buffers entries to be printed when resolving is needed (major speedup).
Workaround for bug in RH 7.1 kernel (Anders Blomdell)
Diffstat (limited to 'quotasys.c')
-rw-r--r--quotasys.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/quotasys.c b/quotasys.c
index b76cf23..d74ca30 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -481,8 +481,27 @@ int kern_quota_format(void)
else if (quotactl(QCMD(Q_GETSTATS, 0), NULL, 0, (void *)&stats) < 0) {
if (errno == ENOSYS || errno == ENOTSUP) /* Quota not compiled? */
return QF_ERROR;
- if (errno == EINVAL || errno == EFAULT || errno == EPERM) /* Old quota compiled? */
- return ret | (1 << QF_VFSOLD);
+ if (errno == EINVAL || errno == EFAULT || errno == EPERM) { /* Old quota compiled? */
+ /* RedHat 7.1 (2.4.2-2) newquota check
+ * Q_GETSTATS in it's old place, Q_GETQUOTA in the new place
+ * (they haven't moved Q_GETSTATS to its new value) */
+ int err_stat = 0;
+ int err_quota = 0;
+ char tmp[1024]; /* Just temporary buffer */
+
+ if (quotactl(QCMD(Q_V1_GETSTATS, 0), NULL, 0, (void *)&stats))
+ err_stat = errno;
+ if (quotactl(QCMD(Q_V1_GETQUOTA, 0), "", 0, tmp))
+ err_quota = errno;
+
+ /* On a RedHat 2.4.2-2 we expect 0, EINVAL
+ * On a 2.4.x we expect 0, ENOENT
+ * On a 2.4.x-ac we wont get here */
+ if (err_stat == 0 && err_quota == EINVAL)
+ return ret | (1 << QF_VFSV0); /* New format supported */
+ else
+ return ret | (1 << QF_VFSOLD);
+ }
die(4, _("Error while detecting kernel quota version: %s\n"), strerror(errno));
}
/* We might do some more generic checks in future but this should be enough for now */