From 5b3f6a273056a22d4d87ea36e108506e854100ed Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 23 Sep 2007 19:45:22 +0000 Subject: [PATCH] Use make_bak_dir() if we get ENOENT while trying to open an inplace backup file. --- generator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- 2.34.1