summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2003-10-18 17:32:49 +0000
committerjkar8572 <jkar8572>2003-10-18 17:32:49 +0000
commit3912b14a2db657893abce87cf9b9a0b2e1df0c5c (patch)
tree1c3ec3157b24a301224999aacc2ed3d04efb30bb
parentd0026af1200f5848032ff77605c674a7885e83eb (diff)
Fixed fake error messages from rpc.rquotad
Fixed reporting of quotas on NFS filesystem without quotas
-rw-r--r--Changelog3
-rw-r--r--quotaops.c4
-rw-r--r--quotasys.c9
-rw-r--r--quotasys.h1
-rw-r--r--rquota_client.c20
-rw-r--r--rquota_server.c6
6 files changed, 22 insertions, 21 deletions
diff --git a/Changelog b/Changelog
index a6fb5ec..4b52a95 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,7 @@
Changes in quota-tools from 3.09 to 3.10
+* Fixed fake error messages from rpc.rquotad (Jan Kara)
+* quota(1) now does not print info for NFS filesystems without quotas (Jan Kara)
+* XFS roothack option disabled by default (Nathan Scott)
* added option to warnquota(8) to supress details of report (Marco van Wieringen)
* fixed problems with multiple lines values in warnquota(8) (F. Depke)
* changed detection of kernel interface so that it works even without /proc (Jan Kara, Johan Ekenberg)
diff --git a/quotaops.c b/quotaops.c
index b9be23b..67ddf9b 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaops.c,v 1.9 2002/11/21 18:37:58 jkar8572 Exp $"
+#ident "$Id: quotaops.c,v 1.10 2003/10/18 17:32:49 jkar8572 Exp $"
#include <rpc/rpc.h>
#include <sys/types.h>
@@ -135,7 +135,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
if (!(q = handles[i]->qh_ops->read_dquot(handles[i], id))) {
/* If rpc.rquotad is not running filesystem might be just without quotas... */
- if (errno != ECONNREFUSED || !quiet)
+ if (errno != ENOENT && (errno != ECONNREFUSED || !quiet))
errstr(_("Error while getting quota from %s for %u: %s\n"),
handles[i]->qh_quotadev, id, strerror(errno));
continue;
diff --git a/quotasys.c b/quotasys.c
index 63cafce..210e068 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -923,7 +923,8 @@ static int process_dirs(int dcnt, char **dirs, int flags)
/* Return st of mountpoint of dir in st.. */
if (flags & MS_NO_MNTPOINT && !(realmnt = find_dir_mntpoint(&st))) {
- errstr(_("Can't find filesystem mountpoint for directory %s\n"), dirs[i]);
+ if (!(flags & MS_QUIET))
+ errstr(_("Can't find filesystem mountpoint for directory %s\n"), dirs[i]);
continue;
}
check_dirs[check_dirs_cnt].sd_dev = st.st_dev;
@@ -939,7 +940,8 @@ static int process_dirs(int dcnt, char **dirs, int flags)
check_dirs[check_dirs_cnt].sd_dev = st.st_rdev;
for (mentry = 0; mentry < mnt_entries_cnt && mnt_entries[mentry].me_dev != st.st_rdev; mentry++);
if (mentry == mnt_entries_cnt) {
- errstr(_("Can't find mountpoint for device %s\n"), dirs[i]);
+ if (!(flags & MS_QUIET))
+ errstr(_("Can't find mountpoint for device %s\n"), dirs[i]);
continue;
}
sstrncpy(mntpointbuf, mnt_entries[mentry].me_dir, PATH_MAX-1);
@@ -952,7 +954,8 @@ static int process_dirs(int dcnt, char **dirs, int flags)
check_dirs_cnt++;
}
if (!check_dirs_cnt) {
- errstr(_("No correct mountpoint specified.\n"));
+ if (!(flags & MS_QUIET))
+ errstr(_("No correct mountpoint specified.\n"));
free(check_dirs);
return -1;
}
diff --git a/quotasys.h b/quotasys.h
index 08f8409..715832e 100644
--- a/quotasys.h
+++ b/quotasys.h
@@ -124,6 +124,7 @@ int kern_quota_on(const char *dev, int type, int fmt);
/* Flags for init_mounts_scan() */
#define MS_NO_MNTPOINT 0x01 /* Specified directory needn't be mountpoint */
#define MS_NO_AUTOFS 0x02 /* Ignore autofs mountpoints */
+#define MS_QUIET 0x04 /* Be quiet with error reporting */
/* Initialize mountpoints scan */
int init_mounts_scan(int dcnt, char **dirs, int flags);
diff --git a/rquota_client.c b/rquota_client.c
index e415bd8..87768eb 100644
--- a/rquota_client.c
+++ b/rquota_client.c
@@ -9,7 +9,7 @@
*
* This part does the rpc-communication with the rquotad.
*
- * Version: $Id: rquota_client.c,v 1.6 2002/06/27 08:14:09 jkar8572 Exp $
+ * Version: $Id: rquota_client.c,v 1.7 2003/10/18 17:32:49 jkar8572 Exp $
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
@@ -109,6 +109,7 @@ int rquota_err(int stat)
case 0:
return -ENOSYS;
case Q_NOQUOTA:
+ return -ENOENT;
case Q_OK:
return 0;
case Q_EPERM:
@@ -124,7 +125,7 @@ int rquota_err(int stat)
int rpc_rquota_get(struct dquot *dquot)
{
CLIENT *clnt;
- getquota_rslt *result;
+ getquota_rslt *result = NULL;
union {
getquota_args arg;
ext_getquota_args ext_arg;
@@ -180,17 +181,13 @@ int rpc_rquota_get(struct dquot *dquot)
result = rquotaproc_getquota_2(&args.ext_arg, clnt);
if (result != NULL && result->status == Q_OK)
clinet2utildqblk(&dquot->dq_dqb, &result->getquota_rslt_u.gqr_rquota);
-
/*
* Destroy unix authentication and RPC client structure.
*/
auth_destroy(clnt->cl_auth);
clnt_destroy(clnt);
}
- else
- result = NULL;
-
- if (result == NULL || !result->status) {
+ else {
if (dquot->dq_h->qh_type == USRQUOTA) {
/*
* Try RQUOTAPROG because server doesn't seem to understand EXT_RQUOTAPROG. (NON-LINUX servers.)
@@ -229,7 +226,7 @@ int rpc_rquota_get(struct dquot *dquot)
}
}
free(fsname_tmp);
- return rquota_err(result?result->status:-1);
+ return rquota_err(result?result->status:-ENOENT);
}
/*
@@ -296,10 +293,7 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
auth_destroy(clnt->cl_auth);
clnt_destroy(clnt);
}
- else
- result = NULL;
-
- if (result == NULL || !result->status) {
+ else {
if (dquot->dq_h->qh_type == USRQUOTA) {
/*
* Try RQUOTAPROG because server doesn't seem to understand EXT_RQUOTAPROG. (NON-LINUX servers.)
@@ -340,7 +334,7 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
}
}
free(fsname_tmp);
- return rquota_err(result?result->status:-1);
+ return rquota_err(result?result->status:-ENOENT);
#endif
return -1;
}
diff --git a/rquota_server.c b/rquota_server.c
index fbc8f71..6e20d74 100644
--- a/rquota_server.c
+++ b/rquota_server.c
@@ -9,7 +9,7 @@
*
* This part does the lookup of the info.
*
- * Version: $Id: rquota_server.c,v 1.12 2003/05/21 19:51:10 jkar8572 Exp $
+ * Version: $Id: rquota_server.c,v 1.13 2003/10/18 17:32:49 jkar8572 Exp $
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
@@ -160,7 +160,7 @@ setquota_rslt *setquotainfo(int flags, caddr_t * argp, struct svc_req *rqstp)
result.status = Q_NOQUOTA;
result.setquota_rslt_u.sqr_rquota.rq_bsize = RPC_DQBLK_SIZE;
- if (init_mounts_scan(1, &pathname, MS_NO_MNTPOINT | (enable_autofs ? 0 : MS_NO_AUTOFS)) < 0)
+ if (init_mounts_scan(1, &pathname, MS_QUIET | MS_NO_MNTPOINT | (enable_autofs ? 0 : MS_NO_AUTOFS)) < 0)
goto out;
if (!(mnt = get_next_mount())) {
end_mounts_scan();
@@ -244,7 +244,7 @@ getquota_rslt *getquotainfo(int flags, caddr_t * argp, struct svc_req * rqstp)
result.status = Q_NOQUOTA;
result.getquota_rslt_u.gqr_rquota.rq_bsize = RPC_DQBLK_SIZE;
- if (init_mounts_scan(1, &pathname, MS_NO_MNTPOINT | (enable_autofs ? 0 : MS_NO_AUTOFS)) < 0)
+ if (init_mounts_scan(1, &pathname, MS_QUIET | MS_NO_MNTPOINT | (enable_autofs ? 0 : MS_NO_AUTOFS)) < 0)
goto out;
if (!(mnt = get_next_mount())) {
end_mounts_scan();