[fix] copyfile dest file empty first (#8012)
This commit is contained in:
parent
459024f306
commit
012aa117af
|
@ -879,7 +879,7 @@ static void copyfile(const char *src, const char *dst)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fd_init(&fd);
|
fd_init(&fd);
|
||||||
if (dfs_file_open(&fd, dst, O_WRONLY | O_CREAT) < 0)
|
if (dfs_file_open(&fd, dst, O_WRONLY | O_CREAT | O_TRUNC) < 0)
|
||||||
{
|
{
|
||||||
rt_free(block_ptr);
|
rt_free(block_ptr);
|
||||||
dfs_file_close(&src_fd);
|
dfs_file_close(&src_fd);
|
||||||
|
|
|
@ -1939,7 +1939,7 @@ static void copyfile(const char *src, const char *dst)
|
||||||
|
|
||||||
dfs_file_init(&dst_file);
|
dfs_file_init(&dst_file);
|
||||||
|
|
||||||
ret = dfs_file_open(&dst_file, dst, O_WRONLY | O_CREAT, 0);
|
ret = dfs_file_open(&dst_file, dst, O_WRONLY | O_CREAT | O_TRUNC, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
dfs_file_deinit(&dst_file);
|
dfs_file_deinit(&dst_file);
|
||||||
|
|
Loading…
Reference in New Issue