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().
This commit is contained in:
parent
d1bad25f40
commit
dffc624b37
@ -1,3 +1,12 @@
|
||||
2010-09-05 Nicolas François <nicolas.francois@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@centraliens.net>
|
||||
|
||||
* man/po/fr.po: Fix 2 fuzzy strings.
|
||||
|
@ -96,6 +96,7 @@ int chown_tree (const char *root,
|
||||
}
|
||||
|
||||
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 @@ int chown_tree (const char *root,
|
||||
* 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);
|
||||
|
@ -273,7 +273,7 @@ static /*@exposed@*/ /*@null@*/struct link_name *check_link (const char *name, c
|
||||
* 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
|
||||
|
@ -88,9 +88,7 @@ int remove_tree (const char *root, bool remove_root)
|
||||
* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user