From: Eric Bollengier Date: Wed, 9 Sep 2009 08:24:20 +0000 (+0200) Subject: Fix #1369 about segfault when using ExcludeDirContaining before defining Options... X-Git-Tag: Release-5.0.0~316^2~16^2~9 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=af393297b65456d07122f3e372ee3985dc747f06;p=bacula%2Fbacula Fix #1369 about segfault when using ExcludeDirContaining before defining Options{} block. --- diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index d9995adef8..0819e76abc 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -806,6 +806,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm } sendit(sock, " N\n"); } + if (incexe->ignoredir) { + sendit(sock, " Z %s\n", incexe->ignoredir); + } for (j=0; jname_list.size(); j++) { sendit(sock, " I %s\n", incexe->name_list.get(j)); } @@ -1026,6 +1029,9 @@ static void free_incexe(INCEXE *incexe) if (incexe->opts_list) { free(incexe->opts_list); } + if (incexe->ignoredir) { + free(incexe->ignoredir); + } free(incexe); } diff --git a/bacula/src/dird/dird_conf.h b/bacula/src/dird/dird_conf.h index 231dfabe5d..55706ec6c4 100644 --- a/bacula/src/dird/dird_conf.h +++ b/bacula/src/dird/dird_conf.h @@ -462,7 +462,6 @@ struct FOPTS { alist drivetype; /* drive type limitation */ char *reader; /* reader program */ char *writer; /* writer program */ - char *ignoredir; /* ignoredir string */ char *plugin; /* plugin program */ }; @@ -474,6 +473,7 @@ struct INCEXE { int32_t num_opts; /* number of options items */ alist name_list; /* filename list -- holds char * */ alist plugin_list; /* filename list for plugins */ + char *ignoredir; /* ignoredir string */ }; /* diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 71d9fc3b61..2ef63d9813 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -354,6 +354,9 @@ static bool send_fileset(JCR *jcr) ie = fileset->exclude_items[i]; fd->fsend("E\n"); } + if (ie->ignoredir) { + bnet_fsend(fd, "Z %s\n", ie->ignoredir); + } for (j=0; jnum_opts; j++) { FOPTS *fo = ie->opts_list[j]; fd->fsend("O %s\n", fo->opts); @@ -399,9 +402,6 @@ static bool send_fileset(JCR *jcr) if (fo->plugin) { fd->fsend("G %s\n", fo->plugin); } - if (fo->ignoredir) { - bnet_fsend(fd, "Z %s\n", fo->ignoredir); - } if (fo->reader) { fd->fsend("D %s\n", fo->reader); } diff --git a/bacula/src/dird/inc_conf.c b/bacula/src/dird/inc_conf.c index ef15d3f2dd..aedde440b4 100644 --- a/bacula/src/dird/inc_conf.c +++ b/bacula/src/dird/inc_conf.c @@ -588,7 +588,7 @@ static void store_excludedir(LEX *lc, RES_ITEM2 *item, int index, int pass, bool } token = lex_get_token(lc, T_NAME); if (pass == 1) { - res_incexe.current_opts->ignoredir = bstrdup(lc->str); + res_incexe.ignoredir = bstrdup(lc->str); } scan_to_eol(lc); }