Module Name: src
Committed By: dholland
Date: Wed Feb 1 06:19:05 UTC 2012
Modified Files:
src/lib/libquota: quota_kernel.c
Log Message:
Fix stupid bug in cursor_getn - it's supposed to return the number of
values retrieved, but it was returning 0 on success. Fortunately nothing
was using it yet.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/quota_kernel.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libquota/quota_kernel.c
diff -u src/lib/libquota/quota_kernel.c:1.3 src/lib/libquota/quota_kernel.c:1.4
--- src/lib/libquota/quota_kernel.c:1.3 Wed Feb 1 05:46:46 2012
+++ src/lib/libquota/quota_kernel.c Wed Feb 1 06:19:05 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: quota_kernel.c,v 1.3 2012/02/01 05:46:46 dholland Exp $ */
+/* $NetBSD: quota_kernel.c,v 1.4 2012/02/01 06:19:05 dholland Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: quota_kernel.c,v 1.3 2012/02/01 05:46:46 dholland Exp $");
+__RCSID("$NetBSD: quota_kernel.c,v 1.4 2012/02/01 06:19:05 dholland Exp $");
#include <stdlib.h>
#include <err.h>
@@ -299,13 +299,22 @@ __quota_kernel_cursor_getn(struct quotah
struct quotactl_args args;
unsigned ret;
+ if (maxnum > INT_MAX) {
+ /* joker, eh? */
+ errno = EINVAL;
+ return -1;
+ }
+
args.qc_op = QUOTACTL_CURSORGET;
args.u.cursorget.qc_cursor = &cursor->kcursor;
args.u.cursorget.qc_keys = keys;
args.u.cursorget.qc_vals = vals;
args.u.cursorget.qc_maxnum = maxnum;
args.u.cursorget.qc_ret = &ret;
- return __quotactl(qh->qh_mountpoint, &args);
+ if (__quotactl(qh->qh_mountpoint, &args) < 0) {
+ return -1;
+ }
+ return ret;
}
int