Skip to content

Commit

Permalink
Add hashtable to delete_in_dir() to fix -x deletions
Browse files Browse the repository at this point in the history
  • Loading branch information
WayneD committed Jun 13, 2020
1 parent f800557 commit ad9f157
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ static void do_delayed_deletions(char *delbuf)
static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
{
static int already_warned = 0;
static struct hashtable *dev_tbl;
struct file_list *dirlist;
char delbuf[MAXPATHLEN];
int dlen, i;
Expand Down Expand Up @@ -305,10 +306,16 @@ static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
change_local_filter_dir(fbuf, dlen, F_DEPTH(file));

if (one_file_system) {
if (file->flags & FLAG_TOP_DIR)
if (!dev_tbl)
dev_tbl = hashtable_create(16, HT_KEY64);
if (file->flags & FLAG_TOP_DIR) {
hashtable_find(dev_tbl, *fs_dev+1, "");
filesystem_dev = *fs_dev;
else if (filesystem_dev != *fs_dev)
return;
} else if (filesystem_dev != *fs_dev) {
if (!hashtable_find(dev_tbl, *fs_dev+1, NULL))
return;
filesystem_dev = *fs_dev; /* it's a prior top-dir dev */
}
}

dirlist = get_dirlist(fbuf, dlen, 0);
Expand Down

0 comments on commit ad9f157

Please sign in to comment.