can't delete a backup file that we just created.
- The rename-directory-for-backup heuristic now checks the
DEL_FORCE_RECURSE flag, not the zap_dir variable. We also set
the flag when we recurse so that only the root dir of a deleted
hierarchy can be missing the flag (and thus be a call from the
generator).
ok = 0;
errno = ENOTEMPTY;
} else if (make_backups && !backup_dir && !is_backup_file(fname)
ok = 0;
errno = ENOTEMPTY;
} else if (make_backups && !backup_dir && !is_backup_file(fname)
+ && !(flags & DEL_FORCE_RECURSE))
ok = make_backup(fname);
else
ok = do_rmdir(fname) == 0;
ok = make_backup(fname);
else
ok = do_rmdir(fname) == 0;
full_fname(fname));
return -1;
}
full_fname(fname));
return -1;
}
+ flags |= DEL_FORCE_RECURSE;
dirlist = get_dirlist(fname, 0);
dirlist = get_dirlist(fname, 0);
- for (j = 0; j < dirlist->count; j++) {
+ for (j = dirlist->count; j-- > 0; ) {
struct file_struct *fp = dirlist->files[j];
f_name_to(fp, buf);
if (delete_file(buf, fp->mode, flags & ~DEL_TERSE) != 0) {
struct file_struct *fp = dirlist->files[j];
f_name_to(fp, buf);
if (delete_file(buf, fp->mode, flags & ~DEL_TERSE) != 0) {
if (flist_find(full_list, dir_list->files[i]) < 0) {
char *fn = f_name_to(dir_list->files[i], fbuf);
int mode = dir_list->files[i]->mode;
if (flist_find(full_list, dir_list->files[i]) < 0) {
char *fn = f_name_to(dir_list->files[i], fbuf);
int mode = dir_list->files[i]->mode;
- int dflag = S_ISDIR(mode) ? DEL_FORCE_RECURSE : 0;
- if (delete_file(fn, mode, dflag) < 0)
+ if (delete_file(fn, mode, DEL_FORCE_RECURSE) < 0)