From: Kern Sibbald Date: Sun, 6 Apr 2008 10:00:46 +0000 (+0000) Subject: kes Eliminate ./configure warning on po directory X-Git-Tag: Release-2.2.9-b7~20 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b6dfb0ae377f18aa319bd63b96b7bc713c2aca6e;p=bacula%2Fbacula kes Eliminate ./configure warning on po directory kes Fix bug #1063, reuse of freed ptr in list nextvol. kes Release regex compile buffer in filed/job.c kes Add proper type of const char in sql_create.c kes Turn off debug in daemon termination routines kes Move free_volume_list() before devices are freed in stored.c kes Fix reference to uninitalized stack variables in bregex.c. This should correct bug #1067. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6747 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/po/Makefile.in.in b/bacula/po/Makefile.in.in index d966318b38..9ff8751cfb 100644 --- a/bacula/po/Makefile.in.in +++ b/bacula/po/Makefile.in.in @@ -25,6 +25,7 @@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datadir = @datadir@ +datarootdir = @datarootdir@ localedir = $(datadir)/locale gettextsrcdir = $(datadir)/gettext/po @@ -185,23 +186,23 @@ install-data-yes: all for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ fi; \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ @@ -234,23 +235,23 @@ installdirs-data-yes: for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ - link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ - mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ - for file in *; do \ - if test -f $$file; then \ - ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ - fi; \ - done); \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ - if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ - :; \ - else \ - rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ - mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ - fi; \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ fi; \ fi; \ done; \ diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 8ffba95043..5e1ee2f26f 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -967,7 +967,7 @@ bail_out: static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar) { int stat; - static char *no_digest = "0"; + static const char *no_digest = "0"; char *digest; ASSERT(ar->JobId); diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index ba93ce9a1d..4b25176e93 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2000-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -324,6 +324,7 @@ void terminate_dird(int sig) exit(1); } already_here = true; + debug_level = 0; /* turn off debug */ stop_watchdog(); generate_daemon_event(NULL, "Exit"); write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs)); diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index 66dc23d51b..8eaaf34f13 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2000-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -446,7 +446,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist) static bool list_nextvol(UAContext *ua, int ndays) { JOB *job; - JCR *jcr = ua->jcr; + JCR *jcr; USTORE store; RUN *run; time_t runtime; @@ -463,23 +463,26 @@ static bool list_nextvol(UAContext *ua, int ndays) } else { job = (JOB *)GetResWithName(R_JOB, ua->argv[i]); if (!job) { - Jmsg(jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]); + Jmsg(ua->jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]); if ((job = select_job_resource(ua)) == NULL) { return false; } } } + + jcr = new_jcr(sizeof(JCR), dird_free_jcr); for (run=NULL; (run = find_next_run(run, job, runtime, ndays)); ) { if (!complete_jcr_for_job(jcr, job, run->pool)) { - return false; + found = false; + goto get_out; } if (!jcr->jr.PoolId) { - ua->error_msg(_("Could not Pool Job %s\n"), job->name()); + ua->error_msg(_("Could not find Pool for Job %s\n"), job->name()); continue; } memset(&pr, 0, sizeof(pr)); pr.PoolId = jcr->jr.PoolId; - if (!db_get_pool_record(ua->jcr, ua->db, &pr)) { + if (!db_get_pool_record(jcr, jcr->db, &pr)) { bstrncpy(pr.Name, "*UnknownPool*", sizeof(pr.Name)); } mr.PoolId = jcr->jr.PoolId; @@ -494,11 +497,12 @@ static bool list_nextvol(UAContext *ua, int ndays) job->name(), pr.Name, level_to_str(run->level), mr.VolumeName); found = true; } - if (jcr->db && jcr->db != ua->db) { - db_close_database(jcr, jcr->db); - jcr->db = NULL; - } } + +get_out: + db_close_database(jcr, jcr->db); + jcr->db = NULL; + free_jcr(jcr); if (!found) { ua->error_msg(_("Could not find next Volume for Job %s.\n"), job->hdr.name); diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 277e32d994..34d0519158 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2000-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -239,6 +239,7 @@ void terminate_filed(int sig) exit(1); /* prevent loops */ } already_here = true; + debug_level = 0; /* turn off debug */ stop_watchdog(); bnet_stop_thread_server(server_tid); diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 03c971d8e8..d54a476b3d 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -289,6 +289,12 @@ void *handle_client_request(void *dirp) for (k=0; kregex.size(); k++) { regfree((regex_t *)fo->regex.get(k)); } + for (k=0; kregexdir.size(); k++) { + regfree((regex_t *)fo->regexdir.get(k)); + } + for (k=0; kregexfile.size(); k++) { + regfree((regex_t *)fo->regexfile.get(k)); + } fo->regex.destroy(); fo->regexdir.destroy(); fo->regexfile.destroy(); diff --git a/bacula/src/lib/bregex.c b/bacula/src/lib/bregex.c index acba19730c..65fe8884ae 100644 --- a/bacula/src/lib/bregex.c +++ b/bacula/src/lib/bregex.c @@ -37,7 +37,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2006-2006 Free Software Foundation Europe e.V. + Copyright (C) 2006-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -1466,7 +1466,7 @@ int regcomp(regex_t * bufp, const char *regex, int cflags) if (bufp->cflags & REG_ICASE) { char *p, *lcase = bstrdup(regex); for( p = lcase; *p ; p++) { - *p = tolower(*p); + *p = tolower(*p); } re_compile_pattern(bufp, (unsigned char *)lcase); bfree(lcase); @@ -1480,8 +1480,8 @@ int regcomp(regex_t * bufp, const char *regex, int cflags) } void re_registers_to_regmatch(regexp_registers_t old_regs, - regmatch_t pmatch[], - size_t nmatch) + regmatch_t pmatch[], + size_t nmatch) { size_t i=0; @@ -1502,7 +1502,9 @@ int regexec(regex_t * preg, const char *string, size_t nmatch, int len = strlen(string); struct re_registers regs; stat = re_search(preg, (unsigned char *)string, len, 0, len, ®s); - re_registers_to_regmatch(®s, pmatch, nmatch); + if (stat >= 0) { + re_registers_to_regmatch(®s, pmatch, nmatch); + } /* stat is the start position in the string base 0 where * the pattern was found or negative if not found. */ @@ -1939,12 +1941,12 @@ int re_search(regex_t * bufp, unsigned char *str, int size, int pos, if (bufp->cflags & REG_ICASE) { /* we must use string in lowercase */ int len = strlen((const char *)str); if (!bufp->lcase) { - bufp->lcase = get_pool_memory(PM_FNAME); + bufp->lcase = get_pool_memory(PM_FNAME); } check_pool_memory_size(bufp->lcase, len+1); unsigned char *dst = (unsigned char *)bufp->lcase; while (*string) { - *dst++ = tolower(*string++); + *dst++ = tolower(*string++); } *dst = '\0'; string = (unsigned char *)bufp->lcase; diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index bcbd606f15..9ec74effae 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -541,6 +541,7 @@ void terminate_stored(int sig) exit(1); } in_here = true; + debug_level = 0; /* turn off any debug */ stop_watchdog(); if (sig == SIGTERM) { /* normal shutdown request? */ @@ -584,6 +585,8 @@ void terminate_stored(int sig) Dmsg1(200, "In terminate_stored() sig=%d\n", sig); + free_volume_list(); + foreach_res(device, R_DEVICE) { Dmsg1(10, "Term device %s\n", device->device_name); if (device->dev) { @@ -606,7 +609,6 @@ void terminate_stored(int sig) } term_msg(); cleanup_crypto(); - free_volume_list(); term_reservations_lock(); close_memory_pool(); diff --git a/bacula/src/version.h b/bacula/src/version.h index e30b7c1746..2c44dc8038 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.2.9-b5" -#define BDATE "04 April 2008" -#define LSMDATE "04Apr08" +#define VERSION "2.2.9-b6" +#define BDATE "06 April 2008" +#define LSMDATE "06Apr08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 98d567553b..13148860f7 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,17 @@ Technical notes on version 2.2 General: +06Apr08 +kes Eliminate ./configure warning on po directory +kes Fix bug #1063, reuse of freed ptr in list nextvol. +kes Release regex compile buffer in filed/job.c +kes Add proper type of const char in sql_create.c +kes Turn off debug in daemon termination routines +kes Move free_volume_list() before devices are freed in stored.c +kes Fix reference to uninitalized stack variables in bregex.c. + This should correct bug #1067. +04Apr08 +kes Fix possible seg fault in SD when freeing a volume entry. 02Apr08 kes Apply patch from bug #1069 that corrects spurious error messages when ACLs enabled on SGI but no ACL exists.