Commit 9d78ed31 authored by Wayne Davison's avatar Wayne Davison

A couple fixes from Shinichi Maruyama.

parent 89afe532
...@@ -130,8 +130,8 @@ failure: ...@@ -130,8 +130,8 @@ failure:
/* robustly move a file, creating new directory structures if necessary */ /* robustly move a file, creating new directory structures if necessary */
static int robust_move(char *src, char *dst) static int robust_move(char *src, char *dst)
{ {
if (robust_rename(src, dst, 0755) != 0 || errno != ENOENT if (robust_rename(src, dst, 0755) != 0 && (errno != ENOENT
|| make_bak_dir(dst) < 0 || robust_rename(src, dst, 0755) != 0) || make_bak_dir(dst) < 0 || robust_rename(src, dst, 0755) != 0))
return -1; return -1;
return 0; return 0;
} }
...@@ -224,7 +224,7 @@ static int keep_backup(char *fname) ...@@ -224,7 +224,7 @@ static int keep_backup(char *fname)
/* move to keep tree if a file */ /* move to keep tree if a file */
if (!kept) { if (!kept) {
if (!robust_move(fname, backup_dir_buf)) { if (robust_move(fname, backup_dir_buf) != 0) {
rprintf(FERROR, "keep_backup failed: %s -> \"%s\": %s\n", rprintf(FERROR, "keep_backup failed: %s -> \"%s\": %s\n",
full_fname(fname), backup_dir_buf, strerror(errno)); full_fname(fname), backup_dir_buf, strerror(errno));
} }
......
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