From a1dc8456c934c038e6d45ff1f04709940bd1a1a9 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sun, 7 Oct 2012 16:03:31 +0200 Subject: [PATCH] fix #1938 about MAXPATHLEN on hurd --- bacula/src/findlib/find.c | 3 +++ bacula/src/findlib/find.h | 1 + bacula/src/findlib/find_one.c | 16 ++++++++-------- 3 files changed, 12 insertions(+), 8 deletions(-) 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 */ -- 2.39.5