From: nekral-guest Date: Fri, 22 May 2009 10:16:12 +0000 (+0000) Subject: * libmisc/copydir.c: Added warning for relative symlinks. X-Git-Tag: 4.1.4.1~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=738ebc04b994811c0e2dbca4ead81fcc7a812686;p=shadow * libmisc/copydir.c: Added warning for relative symlinks. * libmisc/copydir.c (remove_tree): There is no need to check if the root argument exist. opendir() will report this. --- diff --git a/ChangeLog b/ChangeLog index 5383cfb8..491f6dfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-05-21 Nicolas François + + * libmisc/copydir.c: Added warning for relative symlinks. + * libmisc/copydir.c (remove_tree): There is no need to check if + the root argument exist. opendir() will report this. + 2009-05-21 Nicolas François * man/faillog.8.xml: Minor updates. diff --git a/libmisc/copydir.c b/libmisc/copydir.c index 40628b81..644748db 100644 --- a/libmisc/copydir.c +++ b/libmisc/copydir.c @@ -494,6 +494,7 @@ static int copy_symlink (const char *src, const char *dst, /* If src was a link to an entry of the src_orig directory itself, * create a link to the corresponding entry in the dst_orig * directory. + * FIXME: This may change a relative link to an absolute link */ if (strncmp (oldlink, src_orig, strlen (src_orig)) == 0) { size_t len = strlen (dst_orig) + strlen (oldlink) - strlen (src_orig) + 1; @@ -546,7 +547,7 @@ static int copy_hardlink (const char *src, const char *dst, return -1; } - /* FIXME: why is it unlinked? This is a copy, not a move*/ + /* FIXME: why is it unlinked? This is a copy, not a move */ if (unlink (src) != 0) { return -1; } @@ -674,14 +675,6 @@ int remove_tree (const char *root) struct stat sb; DIR *dir; - /* - * Make certain the directory exists. - */ - - if (access (root, F_OK) != 0) { - return -1; - } - /* * Open the source directory and read each entry. Every file * entry in the directory is copied with the UID and GID set