summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-27 17:02:19 +0000
committerDenis Vlasenko2007-08-27 17:02:19 +0000
commit0f214ecef0a65fee01b12e2d75b80c398332b3ba (patch)
tree97069581e6b59530ebaf6e03cb550984661eaff5 /libbb
parent8a5fab6333eee874e0675a89937d31b9ae3a7345 (diff)
downloadbusybox-0f214ecef0a65fee01b12e2d75b80c398332b3ba.zip
busybox-0f214ecef0a65fee01b12e2d75b80c398332b3ba.tar.gz
cp: fix recursion check to not waste bytes remembering names of dirs
Diffstat (limited to 'libbb')
-rw-r--r--libbb/copy_file.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index b70d7b5..efb969f 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -114,7 +114,7 @@ int copy_file(const char *source, const char *dest, int flags)
if (S_ISDIR(source_stat.st_mode)) {
DIR *dp;
- const char *existing_name;
+ const char *tp;
struct dirent *d;
mode_t saved_umask = 0;
@@ -124,11 +124,11 @@ int copy_file(const char *source, const char *dest, int flags)
}
/* Did we ever create source ourself before? */
- existing_name = is_in_ino_dev_hashtable(&source_stat);
- if (existing_name) {
+ tp = is_in_ino_dev_hashtable(&source_stat);
+ if (tp) {
/* We did! it's a recursion! man the lifeboats... */
bb_error_msg("recursion detected, omitting directory '%s'",
- existing_name);
+ source);
return -1;
}
@@ -222,8 +222,7 @@ int copy_file(const char *source, const char *dest, int flags)
int dst_fd;
if (ENABLE_FEATURE_PRESERVE_HARDLINKS && !FLAGS_DEREF) {
- char *link_target;
-
+ const char *link_target;
link_target = is_in_ino_dev_hashtable(&source_stat);
if (link_target) {
if (link(link_target, dest) < 0) {