* 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:
+11
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2008, Ingo Weinhold, [email protected].
|
* Copyright 2005-2009, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -431,6 +431,10 @@ copy_entry(const char *sourcePath, const char *destPath,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copy attributes (before setting the permissions!)
|
||||||
|
copy_attributes(sourcePath, *sourceNode, destPath, *destNode,
|
||||||
|
parameters);
|
||||||
|
|
||||||
// set file owner, group, permissions, times
|
// set file owner, group, permissions, times
|
||||||
destNode->SetOwner(sourceStat.st_uid);
|
destNode->SetOwner(sourceStat.st_uid);
|
||||||
destNode->SetGroup(sourceStat.st_gid);
|
destNode->SetGroup(sourceStat.st_gid);
|
||||||
@@ -450,10 +454,11 @@ copy_entry(const char *sourcePath, const char *destPath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
destNode = &_destNode;
|
destNode = &_destNode;
|
||||||
}
|
|
||||||
|
|
||||||
// copy attributes
|
// copy attributes
|
||||||
copy_attributes(sourcePath, *sourceNode, destPath, *destNode, parameters);
|
copy_attributes(sourcePath, *sourceNode, destPath, *destNode,
|
||||||
|
parameters);
|
||||||
|
}
|
||||||
|
|
||||||
// the destination node is no longer needed
|
// the destination node is no longer needed
|
||||||
destNode->Unset();
|
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 "..",
|
// If the path is the root directory or the leaf is "." or "..",
|
||||||
// we copy the contents only.
|
// we copy the contents only.
|
||||||
int leafLen = sourceLen - leafStart;
|
int leafLen = sourceLen - leafStart;
|
||||||
if (leafLen == 0 || leafLen <= 2
|
if (leafLen == 0 || (leafLen <= 2
|
||||||
&& strncmp(sourcePath + leafStart, "..", leafLen) == 0) {
|
&& strncmp(sourcePath + leafStart, "..", leafLen) == 0)) {
|
||||||
copySourceContentsOnly = true;
|
copySourceContentsOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user