[Pkg-shadow-commits] r3283 - in upstream/trunk: . libmisc
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sun Sep 5 15:34:53 UTC 2010
Author: nekral-guest
Date: 2010-09-05 15:34:42 +0000 (Sun, 05 Sep 2010)
New Revision: 3283
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/chowndir.c
upstream/trunk/libmisc/copydir.c
upstream/trunk/libmisc/remove_tree.c
Log:
Integrate review comments from Julien Cristau
* libmisc/copydir.c: Missing parenthesis in comment.
* libmisc/chowndir.c: Fixed memory leak on failed realloc().
* libmisc/chowndir.c: Make sure the buffer for the path is large
enough.
* libmisc/remove_tree.c: Remove check for NULL before free().
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2010-08-29 19:26:34 UTC (rev 3282)
+++ upstream/trunk/ChangeLog 2010-09-05 15:34:42 UTC (rev 3283)
@@ -1,3 +1,12 @@
+2010-09-05 Nicolas François <nicolas.francois at centraliens.net>
+
+ Integrate review comments from Julien Cristau
+ * libmisc/copydir.c: Missing parenthesis in comment.
+ * libmisc/chowndir.c: Fixed memory leak on failed realloc().
+ * libmisc/chowndir.c: Make sure the buffer for the path is large
+ enough.
+ * libmisc/remove_tree.c: Remove check for NULL before free().
+
2010-08-29 Nicolas François <nicolas.francois at centraliens.net>
* man/po/fr.po: Fix 2 fuzzy strings.
Modified: upstream/trunk/libmisc/chowndir.c
===================================================================
--- upstream/trunk/libmisc/chowndir.c 2010-08-29 19:26:34 UTC (rev 3282)
+++ upstream/trunk/libmisc/chowndir.c 2010-09-05 15:34:42 UTC (rev 3283)
@@ -96,6 +96,7 @@
}
while ((ent = readdir (dir))) {
+ size_t ent_name_len;
uid_t tmpuid = (uid_t) -1;
gid_t tmpgid = (gid_t) -1;
@@ -113,13 +114,15 @@
* destination files.
*/
- if (strlen (root) + strlen (ent->d_name) + 2 > new_name_len) {
- new_name = realloc (new_name, new_name_len + 1024);
- if (NULL == new_name) {
+ ent_name_len = strlen (root) + strlen (ent->d_name) + 2;
+ if (ent_name_len > new_name_len) {
+ char *tmp = realloc (new_name, ent_name_len);
+ if (NULL == tmp) {
rc = -1;
break;
}
- new_name_len += 1024;
+ new_name = tmp;
+ new_name_len = ent_name_len;
}
(void) snprintf (new_name, new_name_len, "%s/%s", root, ent->d_name);
Modified: upstream/trunk/libmisc/copydir.c
===================================================================
--- upstream/trunk/libmisc/copydir.c 2010-08-29 19:26:34 UTC (rev 3282)
+++ upstream/trunk/libmisc/copydir.c 2010-09-05 15:34:42 UTC (rev 3283)
@@ -273,7 +273,7 @@
* as it goes.
*
* When reset_selinux is enabled, extended attributes (and thus
- * SELinux attributes are not copied.
+ * SELinux attributes) are not copied.
*
* old_uid and new_uid are used to set the ownership of the copied
* files. Unless old_uid is set to -1, only the files owned by
Modified: upstream/trunk/libmisc/remove_tree.c
===================================================================
--- upstream/trunk/libmisc/remove_tree.c 2010-08-29 19:26:34 UTC (rev 3282)
+++ upstream/trunk/libmisc/remove_tree.c 2010-09-05 15:34:42 UTC (rev 3283)
@@ -88,9 +88,7 @@
* Make the filename for the current entry.
*/
- if (NULL != new_name) {
- free (new_name);
- }
+ free (new_name);
new_name = (char *) malloc (new_len);
if (NULL == new_name) {
err = -1;
More information about the Pkg-shadow-commits
mailing list