From 472866d15139b42633a0fdcade9126263802b6b1 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 9 Sep 2009 14:18:57 +0200 Subject: [PATCH] Fix #1370 about the implementation of the "Exclude Dir Containing" option on FD. --- bacula/src/filed/job.c | 20 +++++++++++--------- bacula/src/findlib/find.c | 3 ++- bacula/src/findlib/find.h | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 4054b29f30..549d6b704e 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -342,13 +342,13 @@ void *handle_client_request(void *dirp) fo->base.destroy(); fo->fstype.destroy(); fo->drivetype.destroy(); - if (fo->ignoredir != NULL) { - free(fo->ignoredir); - } } incexe->opts_list.destroy(); incexe->name_list.destroy(); incexe->plugin_list.destroy(); + if (incexe->ignoredir) { + free(incexe->ignoredir); + } } fileset->include_list.destroy(); @@ -371,6 +371,9 @@ void *handle_client_request(void *dirp) incexe->opts_list.destroy(); incexe->name_list.destroy(); incexe->plugin_list.destroy(); + if (incexe->ignoredir) { + free(incexe->ignoredir); + } } fileset->exclude_list.destroy(); free(fileset); @@ -876,9 +879,8 @@ static void add_fileset(JCR *jcr, const char *item) state = state_options; break; case 'Z': - current_opts = start_options(ff); - current_opts->ignoredir = bstrdup(item); - state = state_options; + state = state_include; + fileset->incexe->ignoredir = bstrdup(item); break; case 'D': current_opts = start_options(ff); @@ -941,9 +943,9 @@ static bool term_fileset(JCR *jcr) for (k=0; kdrivetype.size(); k++) { Dmsg1(400, "XD %s\n", (char *)fo->drivetype.get(k)); } - if (fo->ignoredir) { - Dmsg1(400, "Z %s\n", fo->ignoredir); - } + } + if (incexe->ignoredir) { + Dmsg1(400, "Z %s\n", incexe->ignoredir); } dlistString *node; foreach_dlist(node, &incexe->name_list) { diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 81e887a292..d089b703a8 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -274,11 +274,12 @@ static bool accept_file(FF_PKT *ff) basename = ff->fname; } + ff->ignoredir = incexe->ignoredir; + for (j = 0; j < incexe->opts_list.size(); j++) { findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j); ff->flags = fo->flags; ff->GZIP_level = fo->GZIP_level; - ff->ignoredir = fo->ignoredir; ff->fstypes = fo->fstype; ff->drivetypes = fo->drivetype; diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index 030aa3f392..ff9be472eb 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -151,7 +151,6 @@ struct findFOPTS { alist base; /* list of base names */ alist fstype; /* file system type limitation */ alist drivetype; /* drive type limitation */ - char *ignoredir; /* ignore directories with this file */ }; @@ -161,6 +160,7 @@ struct findINCEXE { alist opts_list; /* options list */ dlist name_list; /* filename list -- holds dlistString */ dlist plugin_list; /* plugin list -- holds dlistString */ + char *ignoredir; /* ignore directories with this file */ }; /* -- 2.39.5