From: Eric Bollengier Date: Sun, 7 Oct 2012 14:03:31 +0000 (+0200) Subject: fix #1938 about MAXPATHLEN on hurd X-Git-Tag: Release-7.0.0~104 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=28b4ef28c995ed9a28b20252ee14e22a0ef00100;p=bacula%2Fbacula fix #1938 about MAXPATHLEN on hurd --- diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 68c70efeff..dba28bf36a 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -505,6 +505,9 @@ term_find_files(FF_PKT *ff) if (ff->link_save) { free_pool_memory(ff->link_save); } + if (ff->ignoredir_fname) { + free_pool_memory(ff->ignoredir_fname); + } hard_links = term_find_one(ff); free(ff); return hard_links; diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index a91ba882b4..8d6be394b2 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -169,6 +169,7 @@ struct FF_PKT { POOLMEM *sys_fname; /* system filename */ POOLMEM *fname_save; /* save when stripping path */ POOLMEM *link_save; /* save when stripping path */ + POOLMEM *ignoredir_fname; /* used to ignore directories */ char *digest; /* set to file digest when the file is a hardlink */ struct stat statp; /* stat packet */ uint32_t digest_len; /* set to the digest len when the file is a hardlink*/ diff --git a/bacula/src/findlib/find_one.c b/bacula/src/findlib/find_one.c index 36708d3433..d8549944c8 100644 --- a/bacula/src/findlib/find_one.c +++ b/bacula/src/findlib/find_one.c @@ -103,6 +103,7 @@ static FF_PKT *new_dir_ff_pkt(FF_PKT *ff_pkt) dir_ff_pkt->linkhash = NULL; dir_ff_pkt->fname_save = NULL; dir_ff_pkt->link_save = NULL; + dir_ff_pkt->ignoredir_fname = NULL; return dir_ff_pkt; } @@ -120,6 +121,9 @@ static void free_dir_ff_pkt(FF_PKT *dir_ff_pkt) if (dir_ff_pkt->link_save) { free_pool_memory(dir_ff_pkt->link_save); } + if (dir_ff_pkt->ignoredir_fname) { + free_pool_memory(dir_ff_pkt->ignoredir_fname); + } free(dir_ff_pkt); } @@ -308,7 +312,6 @@ bool check_changes(JCR *jcr, FF_PKT *ff_pkt) static bool have_ignoredir(FF_PKT *ff_pkt) { struct stat sb; - char tmp_name[MAXPATHLEN]; char *ignoredir; /* Ensure that pointers are defined */ @@ -318,14 +321,11 @@ static bool have_ignoredir(FF_PKT *ff_pkt) ignoredir = ff_pkt->fileset->incexe->ignoredir; if (ignoredir) { - if (strlen(ff_pkt->fname) + strlen(ignoredir) + 2 > MAXPATHLEN) { - return false; + if (!ff_pkt->ignoredir_fname) { + ff_pkt->ignoredir_fname = get_pool_memory(PM_FNAME); } - - strcpy(tmp_name, ff_pkt->fname); - strcat(tmp_name, "/"); - strcat(tmp_name, ignoredir); - if (stat(tmp_name, &sb) == 0) { + Mmsg(ff_pkt->ignoredir_fname, "%s/%s", ff_pkt->fname, ignoredir); + if (stat(ff_pkt->ignoredir_fname, &sb) == 0) { Dmsg2(100, "Directory '%s' ignored (found %s)\n", ff_pkt->fname, ignoredir); return true; /* Just ignore this directory */