CVS commit: [bouyer-quota2] src/usr.sbin/quotactl

2011-02-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Feb 11 12:44:40 UTC 2011

Modified Files:
src/usr.sbin/quotactl [bouyer-quota2]: quotactl.8

Log Message:
Add an example plist


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/quotactl/quotactl.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/quotactl/quotactl.8
diff -u src/usr.sbin/quotactl/quotactl.8:1.1.2.1 src/usr.sbin/quotactl/quotactl.8:1.1.2.2
--- src/usr.sbin/quotactl/quotactl.8:1.1.2.1	Mon Jan 31 21:14:06 2011
+++ src/usr.sbin/quotactl/quotactl.8	Fri Feb 11 12:44:39 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: quotactl.8,v 1.1.2.1 2011/01/31 21:14:06 bouyer Exp $
+.\	$NetBSD: quotactl.8,v 1.1.2.2 2011/02/11 12:44:39 bouyer Exp $
 .\
 .\ Copyright (c) 2011 Manuel Bouyer
 .\ All rights reserved.
@@ -67,6 +67,62 @@
 .Fl x
 is present, a message is printed to stderr for each failed command,
 and the exit status will be 2 if any comand failed.
+.Sh EXAMPLES
+This will set the quota limits for user id 100 on the filesystem /home:
+.Bd -literal
+quotactl /home  EOF
+?xml version=1.0 encoding=UTF-8?
+!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd;
+plist version=1.0
+dict
+keycommands/key
+array
+dict
+keycommand/key
+stringset/string
+keydata/key
+array
+dict
+keyblock/key
+dict
+keyexpire time/key
+integer0/integer
+keygrace time/key
+integer2419200/integer
+keyhard/key
+integer0x2000/integer
+keysoft/key
+integer0x1000/integer
+keyusage/key
+integer0x0/integer
+/dict
+keyfile/key
+dict
+keyexpire time/key
+integer0/integer
+keygrace time/key
+integer172800/integer
+keyhard/key
+integer0x800/integer
+keysoft/key
+integer0x400/integer
+keyusage/key
+integer0x0/integer
+/dict
+keyid/key
+integer100/integer
+/dict
+/array
+keytype/key
+stringuser/string
+/dict
+/array
+keyinterface version/key
+integer0x1/integer
+/dict
+/plist
+EOF
+
 .Sh SEE ALSO
 .Xr quota 1 ,
 .Xr quotactl 2 ,



CVS commit: [bouyer-quota2] src/usr.sbin/quotactl

2011-02-11 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Feb 11 15:05:35 UTC 2011

Modified Files:
src/usr.sbin/quotactl [bouyer-quota2]: quotactl.c

Log Message:
Fix pointers if realloc return a different memory area.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/quotactl/quotactl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/quotactl/quotactl.c
diff -u src/usr.sbin/quotactl/quotactl.c:1.1.2.1 src/usr.sbin/quotactl/quotactl.c:1.1.2.2
--- src/usr.sbin/quotactl/quotactl.c:1.1.2.1	Mon Jan 31 21:14:06 2011
+++ src/usr.sbin/quotactl/quotactl.c	Fri Feb 11 15:05:35 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: quotactl.c,v 1.1.2.1 2011/01/31 21:14:06 bouyer Exp $ */
+/* $NetBSD: quotactl.c,v 1.1.2.2 2011/02/11 15:05:35 bouyer Exp $ */
 /*-
   * Copyright (c) 2011 Manuel Bouyer
   * All rights reserved.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: quotactl.c,v 1.1.2.1 2011/01/31 21:14:06 bouyer Exp $);
+__RCSID($NetBSD: quotactl.c,v 1.1.2.2 2011/02/11 15:05:35 bouyer Exp $);
 #endif /* not lint */
 
 /*
@@ -107,10 +107,10 @@
 		plist = realloc(plist, plistsize + READ_SIZE);
 		if (plist == NULL)
 			err(1, realloc buffer);
-		p += READ_SIZE;
+		p = plist + plistsize;
 		plistsize += READ_SIZE;
 	}
-	if (ferror(f))
+	if (!feof(f))
 		err(1, error reading %s, xmlfile);
 
 	qdict = prop_dictionary_internalize(plist);