Source-Changes-HG archive

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

[src/bouyer-quota2]: src/usr.sbin/quotactl Fix pointers if realloc return a d...



details:   https://anonhg.NetBSD.org/src/rev/62e28d663ccf
branches:  bouyer-quota2
changeset: 761162:62e28d663ccf
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Feb 11 15:05:35 2011 +0000

description:
Fix pointers if realloc return a different memory area.

diffstat:

 usr.sbin/quotactl/quotactl.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 8d04526943f4 -r 62e28d663ccf usr.sbin/quotactl/quotactl.c
--- a/usr.sbin/quotactl/quotactl.c      Fri Feb 11 12:58:50 2011 +0000
+++ b/usr.sbin/quotactl/quotactl.c      Fri Feb 11 15:05:35 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index