mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-30 21:50:47 +01:00
Fixed missing failOnOverwrite check
This commit is contained in:
@@ -386,7 +386,7 @@ void FileImpl::renameToImpl(const std::string& path, bool failOnOverwrite)
|
|||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat(path.c_str(), &st) == 0)
|
if (stat(path.c_str(), &st) == 0 && failOnOverwrite)
|
||||||
throw FileExistsException(path, EEXIST);
|
throw FileExistsException(path, EEXIST);
|
||||||
|
|
||||||
if (rename(_path.c_str(), path.c_str()) != 0)
|
if (rename(_path.c_str(), path.c_str()) != 0)
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ void FileImpl::renameToImpl(const std::string& path, bool failOnOverwrite)
|
|||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat(path.c_str(), &st) == 0)
|
if (stat(path.c_str(), &st) == 0 && failOnOverwrite)
|
||||||
throw FileExistsException(path, EEXIST);
|
throw FileExistsException(path, EEXIST);
|
||||||
|
|
||||||
if (rename(_path.c_str(), path.c_str()) != 0)
|
if (rename(_path.c_str(), path.c_str()) != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user