* Copy the attributes before setting the destination's permissions. At least

under Linux this caused trouble for files without write permission.
* Fixed gcc4 warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30833 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-05-23 23:56:08 +00:00
parent a84f41d8a0
commit a428058ded
1 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005-2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2005-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
@ -431,6 +431,10 @@ copy_entry(const char *sourcePath, const char *destPath,
exit(1);
}
// copy attributes (before setting the permissions!)
copy_attributes(sourcePath, *sourceNode, destPath, *destNode,
parameters);
// set file owner, group, permissions, times
destNode->SetOwner(sourceStat.st_uid);
destNode->SetGroup(sourceStat.st_gid);
@ -450,10 +454,11 @@ copy_entry(const char *sourcePath, const char *destPath,
}
destNode = &_destNode;
}
// copy attributes
copy_attributes(sourcePath, *sourceNode, destPath, *destNode, parameters);
copy_attributes(sourcePath, *sourceNode, destPath, *destNode,
parameters);
}
// the destination node is no longer needed
destNode->Unset();
@ -583,8 +588,8 @@ copy_files(const char **sourcePaths, int sourceCount,
// If the path is the root directory or the leaf is "." or "..",
// we copy the contents only.
int leafLen = sourceLen - leafStart;
if (leafLen == 0 || leafLen <= 2
&& strncmp(sourcePath + leafStart, "..", leafLen) == 0) {
if (leafLen == 0 || (leafLen <= 2
&& strncmp(sourcePath + leafStart, "..", leafLen) == 0)) {
copySourceContentsOnly = true;
}
}