From: Kern Sibbald Date: Fri, 28 May 2004 20:51:19 +0000 (+0000) Subject: Apply Peter Eriksson's fixes X-Git-Tag: Release-1.34.3~29 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=166ea43ccdf8fc3600cefa672b029b06610953f9;p=bacula%2Fbacula Apply Peter Eriksson's fixes git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1375 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 0511dc946f..491212b0f6 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -351,7 +351,7 @@ struct s_jl joblevels[] = { {"Data", L_VERIFY_DATA, JT_VERIFY}, {" ", L_NONE, JT_ADMIN}, {" ", L_NONE, JT_RESTORE}, - {NULL, 0} + {NULL, 0, 0} }; /* Keywords (RHS) permitted in Job type records diff --git a/bacula/src/dird/ua_select.c b/bacula/src/dird/ua_select.c index 991af1fe19..8f4e255b18 100644 --- a/bacula/src/dird/ua_select.c +++ b/bacula/src/dird/ua_select.c @@ -803,7 +803,7 @@ STORE *get_storage_resource(UAContext *ua, int use_default) } else if (strcasecmp(ua->argk[i], _("job")) == 0) { if (!ua->argv[i]) { - bsendmsg(ua, _("Job name not specified.\n")); + bsendmsg(ua, _("Expecting job=xxx, got: %s.\n"), ua->argk[i]); return NULL; } if (!(jcr=get_jcr_by_partial_name(ua->argv[i]))) { diff --git a/bacula/src/lib/edit.c b/bacula/src/lib/edit.c index 77da413529..d1ca7fefbf 100644 --- a/bacula/src/lib/edit.c +++ b/bacula/src/lib/edit.c @@ -85,7 +85,7 @@ int64_t str_to_int64(char *str) */ char *edit_uint64_with_commas(uint64_t val, char *buf) { - sprintf(buf, "%" lld, val); + sprintf(buf, "%" llu, val); return add_commas(buf, buf); } @@ -96,7 +96,7 @@ char *edit_uint64_with_commas(uint64_t val, char *buf) */ char *edit_uint64(uint64_t val, char *buf) { - sprintf(buf, "%" lld, val); + sprintf(buf, "%" llu, val); return buf; } diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index 56d7696d5a..8c4466051e 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -103,7 +103,7 @@ RES_ITEM msgs_items[] = { {"director", store_msgs, ITEM(res_msgs), MD_DIRECTOR, 0, 0}, {"console", store_msgs, ITEM(res_msgs), MD_CONSOLE, 0, 0}, {"operator", store_msgs, ITEM(res_msgs), MD_OPERATOR, 0, 0}, - {NULL, NULL, NULL, 0} + {NULL, NULL, NULL, 0, 0} }; struct s_mtypes { @@ -701,8 +701,8 @@ parse_config(const char *cf, int exit_on_error) for (pass=1; pass <= 2; pass++) { Dmsg1(300, "parse_config pass %d\n", pass); if ((lc = lex_open_file(lc, cf, NULL)) == NULL) { - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } while ((token=lex_get_token(lc, T_ALL)) != T_EOF) { Dmsg1(300, "parse got token=%s\n", lex_tok_to_str(token)); @@ -713,8 +713,8 @@ parse_config(const char *cf, int exit_on_error) } if (token != T_IDENTIFIER) { scan_err1(lc, _("Expected a Resource name identifier, got: %s"), lc->str); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } for (i=0; resources[i].name; i++) if (strcasecmp(resources[i].name, lc->str) == 0) { @@ -726,8 +726,8 @@ parse_config(const char *cf, int exit_on_error) } if (state == p_none) { scan_err1(lc, _("expected resource name, got: %s"), lc->str); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } break; case p_resource: @@ -738,8 +738,8 @@ parse_config(const char *cf, int exit_on_error) case T_IDENTIFIER: if (level != 1) { scan_err1(lc, _("not in resource definition: %s"), lc->str); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } for (i=0; items[i].name; i++) { if (strcasecmp(items[i].name, lc->str) == 0) { @@ -750,8 +750,8 @@ parse_config(const char *cf, int exit_on_error) Dmsg1 (300, "in T_IDENT got token=%s\n", lex_tok_to_str(token)); if (token != T_EQUALS) { scan_err1(lc, _("expected an equals, got: %s"), lc->str); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } } Dmsg1(300, "calling handler for %s\n", items[i].name); @@ -766,8 +766,8 @@ parse_config(const char *cf, int exit_on_error) Dmsg1(300, "Keyword = %s\n", lc->str); scan_err1(lc, _("Keyword \"%s\" not permitted in this resource.\n" "Perhaps you left the trailing brace off of the previous resource."), lc->str); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } break; @@ -784,20 +784,20 @@ parse_config(const char *cf, int exit_on_error) default: scan_err2(lc, _("unexpected token %d %s in resource definition"), token, lex_tok_to_str(token)); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } break; default: scan_err1(lc, _("Unknown parser state %d\n"), state); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } } if (state != p_none) { scan_err0(lc, _("End of conf file reached with unclosed resource.")); - set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ - return 0; + set_exit_on_error(1); /* Never reached if exit_on_error == 1 */ + return 0; } if (debug_level > 50 && pass == 2) { int i; diff --git a/bacula/src/stored/record.c b/bacula/src/stored/record.c index b5bdcf3428..cc8ea04b71 100644 --- a/bacula/src/stored/record.c +++ b/bacula/src/stored/record.c @@ -193,7 +193,7 @@ int write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec) remlen = block->buf_len - block->binbuf; ASSERT(block->binbuf == (uint32_t) (block->bufp - block->buf)); - ASSERT(remlen >= 0); + ASSERT(block->buf_len >= block->binbuf); Dmsg6(190, "write_record_to_block() FI=%s SessId=%d Strm=%s len=%d\n\ rem=%d remainder=%d\n", diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index 65e86d3384..ad1e4c0b05 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -164,9 +164,10 @@ static bool close_data_spool_file(JCR *jcr) P(mutex); spool_stats.data_jobs--; spool_stats.total_data_jobs++; - spool_stats.data_size -= jcr->dcr->spool_size; - if (spool_stats.data_size < 0) { + if (spool_stats.data_size < jcr->dcr->spool_size) { spool_stats.data_size = 0; + } else { + spool_stats.data_size -= jcr->dcr->spool_size; } jcr->dcr->spool_size = 0; V(mutex); @@ -237,9 +238,10 @@ static bool despool_data(DCR *dcr) } P(mutex); - spool_stats.data_size -= dcr->spool_size; - if (spool_stats.data_size < 0) { + if (spool_stats.data_size < dcr->spool_size) { spool_stats.data_size = 0; + } else { + spool_stats.data_size -= dcr->spool_size; } V(mutex); P(dcr->dev->spool_mutex);