Commit 5b3f6a27 authored by Wayne Davison's avatar Wayne Davison

Use make_bak_dir() if we get ENOENT while trying to open an

inplace backup file.
parent f2032668
...@@ -1709,8 +1709,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, ...@@ -1709,8 +1709,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
close(fd); close(fd);
goto cleanup; goto cleanup;
} }
if ((f_copy = do_open(backupptr, if ((f_copy = do_open(backupptr, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0
O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) { && (errno != ENOENT || make_bak_dir(backupptr) < 0
|| (f_copy = do_open(backupptr, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0)) {
rsyserr(FERROR, errno, "open %s", rsyserr(FERROR, errno, "open %s",
full_fname(backupptr)); full_fname(backupptr));
unmake_file(back_file); unmake_file(back_file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment