Fixed "cp" (and "mv") leaking file descriptors like crazy when copying attributes, thanks to Ingo for noticing this.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20223 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0b9da247dc
commit
ed518e4b22
@ -163,8 +163,8 @@ copy_attributes(int fromFd, int toFd)
|
||||
static int
|
||||
copy_attributes_by_name(const char *from, const char *to, int resolveLinks)
|
||||
{
|
||||
int fromFd, toFd;
|
||||
printf("%s -> %s\n", from, to);
|
||||
int fromFd, toFd, result;
|
||||
|
||||
fromFd = open(from, O_RDONLY | (resolveLinks ? 0 : O_NOTRAVERSE));
|
||||
if (fromFd < 0)
|
||||
return -1;
|
||||
@ -175,7 +175,12 @@ copy_attributes_by_name(const char *from, const char *to, int resolveLinks)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return copy_attributes(fromFd, toFd);
|
||||
result = copy_attributes(fromFd, toFd);
|
||||
|
||||
close(fromFd);
|
||||
close(toFd);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user