From: Wayne Davison Date: Sun, 23 Sep 2007 19:45:22 +0000 (+0000) Subject: Use make_bak_dir() if we get ENOENT while trying to open an X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/5b3f6a273056a22d4d87ea36e108506e854100ed Use make_bak_dir() if we get ENOENT while trying to open an inplace backup file. --- diff --git a/generator.c b/generator.c index f711ffdb..271b55fa 100644 --- a/generator.c +++ b/generator.c @@ -1709,8 +1709,9 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, close(fd); goto cleanup; } - if ((f_copy = do_open(backupptr, - O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) { + if ((f_copy = do_open(backupptr, 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", full_fname(backupptr)); unmake_file(back_file);