Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libquota Handle default ID case in quota_get(), based on...



details:   https://anonhg.NetBSD.org/src/rev/01d49008ca17
branches:  trunk
changeset: 772602:01d49008ca17
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Jan 09 15:32:38 2012 +0000

description:
Handle default ID case in quota_get(), based on logic found in
/usr/bin/quota.

diffstat:

 lib/libquota/quota_proplib.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r 08b41b11ea03 -r 01d49008ca17 lib/libquota/quota_proplib.c
--- a/lib/libquota/quota_proplib.c      Mon Jan 09 15:31:11 2012 +0000
+++ b/lib/libquota/quota_proplib.c      Mon Jan 09 15:32:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quota_proplib.c,v 1.1 2012/01/09 15:27:04 dholland Exp $       */
+/*     $NetBSD: quota_proplib.c,v 1.2 2012/01/09 15:32:38 dholland Exp $       */
 /*-
   * Copyright (c) 2011 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: quota_proplib.c,v 1.1 2012/01/09 15:27:04 dholland Exp $");
+__RCSID("$NetBSD: quota_proplib.c,v 1.2 2012/01/09 15:32:38 dholland Exp $");
 
 #include <string.h>
 #include <errno.h>
@@ -73,10 +73,18 @@
                errno = ENOMEM;
                return -1;
        }
-       if (!prop_dictionary_set_uint32(data, "id", qk->qk_id)) {
-               prop_object_release(data);
-               errno = ENOMEM;
-               return -1;
+       if (qk->qk_id == QUOTA_DEFAULTID) {
+               if (!prop_dictionary_set_cstring(data, "id", "default")) {
+                       prop_object_release(data);
+                       errno = ENOMEM;
+                       return -1;
+               }
+       } else {
+               if (!prop_dictionary_set_uint32(data, "id", qk->qk_id)) {
+                       prop_object_release(data);
+                       errno = ENOMEM;
+                       return -1;
+               }
        }
 
        datas = prop_array_create();



Home | Main Index | Thread Index | Old Index