mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
copy on mac instead renaming
This commit is contained in:
parent
407b7a4651
commit
3aefd0f50b
@ -529,14 +529,22 @@ int main(int/* argc*/, char* argv[])
|
|||||||
char decompressed_name[decompressed_name_len + 1];
|
char decompressed_name[decompressed_name_len + 1];
|
||||||
(void)snprintf(decompressed_name, decompressed_name_len + 1, decompressed_name_fmt, self, decompressed_suffix);
|
(void)snprintf(decompressed_name, decompressed_name_len + 1, decompressed_name_fmt, self, decompressed_suffix);
|
||||||
|
|
||||||
|
#if defined(OS_DARWIN)
|
||||||
|
// We can't just rename it on Mac due to security issues, so we copy it...
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
|
std::filesystem::copy_file(static_cast<char *>(decompressed_name), static_cast<char *>(self), ec);
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
std::cerr << ec.message() << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (link(decompressed_name, self))
|
if (link(decompressed_name, self))
|
||||||
{
|
{
|
||||||
perror("link");
|
perror("link");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (chmod(self, static_cast<uint32_t>(decompressed_umask)))
|
if (chmod(self, static_cast<uint32_t>(decompressed_umask)))
|
||||||
{
|
{
|
||||||
perror("chmod");
|
perror("chmod");
|
||||||
|
Loading…
Reference in New Issue
Block a user