mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Use open and fail if the file already exists.
This commit is contained in:
parent
0e499d0b30
commit
e756830696
@ -123,8 +123,7 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) {
|
||||
|
||||
/* Open the destination file */
|
||||
ctx->replica = drep;
|
||||
dfp = csync_vio_creat(ctx, turi, 0644);
|
||||
while (dfp == NULL) {
|
||||
while ((dfp = csync_vio_open(ctx, turi, O_CREAT|O_EXCL|O_WRONLY, st->mode)) == NULL) {
|
||||
switch (errno) {
|
||||
case ENOENT:
|
||||
break;
|
||||
@ -150,7 +149,6 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) {
|
||||
if (csync_vio_mkdirs(ctx, tdir, 0755) < 0) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_WARN, "dir: %s, command: mkdirs, error: %s", tdir, strerror(errno));
|
||||
}
|
||||
dfp = csync_vio_creat(ctx, turi, st->mode);
|
||||
}
|
||||
|
||||
/* copy file */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user