Skip to content

Commit

Permalink
Remove ridiculous arbitrary limit on plugin messages.
Browse files Browse the repository at this point in the history
Seems we inherited some really ridiculous arbitrary limits on the
upper limit of debug and Job messages. Lets use a POOL_MEM so we
can handle any size.
  • Loading branch information
Marco van Wieringen committed Jun 19, 2015
1 parent 690e9ed commit 4bb54d0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
16 changes: 9 additions & 7 deletions src/dird/dir_plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,9 @@ static bRC bareosRegisterEvents(bpContext *ctx, int nr_events, ...)
static bRC bareosJobMsg(bpContext *ctx, const char *file, int line,
int type, utime_t mtime, const char *fmt, ...)
{
va_list arg_ptr;
char buf[2000];
JCR *jcr;
va_list arg_ptr;
POOL_MEM buffer(PM_MESSAGE);

if (ctx) {
jcr = ((b_plugin_ctx *)ctx->bContext)->jcr;
Expand All @@ -713,22 +713,24 @@ static bRC bareosJobMsg(bpContext *ctx, const char *file, int line,
}

va_start(arg_ptr, fmt);
bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
buffer.bvsprintf(fmt, arg_ptr);
va_end(arg_ptr);
Jmsg(jcr, type, mtime, "%s", buf);
Jmsg(jcr, type, mtime, "%s", buffer.c_str());

return bRC_OK;
}

static bRC bareosDebugMsg(bpContext *ctx, const char *file, int line,
int level, const char *fmt, ...)
{
va_list arg_ptr;
char buf[2000];
POOL_MEM buffer(PM_MESSAGE);

va_start(arg_ptr, fmt);
bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
buffer.bvsprintf(fmt, arg_ptr);
va_end(arg_ptr);
d_msg(file, line, level, "%s", buf);
d_msg(file, line, level, "%s", buffer.c_str());

return bRC_OK;
}

Expand Down
14 changes: 7 additions & 7 deletions src/filed/fd_plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -2089,9 +2089,9 @@ static bRC bareosRegisterEvents(bpContext *ctx, int nr_events, ...)
static bRC bareosJobMsg(bpContext *ctx, const char *file, int line,
int type, utime_t mtime, const char *fmt, ...)
{
va_list arg_ptr;
char buf[2000];
JCR *jcr;
va_list arg_ptr;
POOL_MEM buffer(PM_MESSAGE);

if (ctx) {
jcr = ((b_plugin_ctx *)ctx->bContext)->jcr;
Expand All @@ -2100,9 +2100,9 @@ static bRC bareosJobMsg(bpContext *ctx, const char *file, int line,
}

va_start(arg_ptr, fmt);
bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
buffer.bvsprintf(fmt, arg_ptr);
va_end(arg_ptr);
Jmsg(jcr, type, mtime, "%s", buf);
Jmsg(jcr, type, mtime, "%s", buffer.c_str());

return bRC_OK;
}
Expand All @@ -2111,12 +2111,12 @@ static bRC bareosDebugMsg(bpContext *ctx, const char *file, int line,
int level, const char *fmt, ...)
{
va_list arg_ptr;
char buf[2000];
POOL_MEM buffer(PM_MESSAGE);

va_start(arg_ptr, fmt);
bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
buffer.bvsprintf(fmt, arg_ptr);
va_end(arg_ptr);
d_msg(file, line, level, "%s", buf);
d_msg(file, line, level, "%s", buffer.c_str());

return bRC_OK;
}
Expand Down
16 changes: 9 additions & 7 deletions src/stored/sd_plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,9 @@ static bRC bareosRegisterEvents(bpContext *ctx, int nr_events, ...)
static bRC bareosJobMsg(bpContext *ctx, const char *file, int line,
int type, utime_t mtime, const char *fmt, ...)
{
va_list arg_ptr;
char buf[2000];
JCR *jcr;
va_list arg_ptr;
POOL_MEM buffer(PM_MESSAGE);

if (ctx) {
jcr = ((b_plugin_ctx *)ctx->bContext)->jcr;
Expand All @@ -784,22 +784,24 @@ static bRC bareosJobMsg(bpContext *ctx, const char *file, int line,
}

va_start(arg_ptr, fmt);
bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
buffer.bvsprintf(fmt, arg_ptr);
va_end(arg_ptr);
Jmsg(jcr, type, mtime, "%s", buf);
Jmsg(jcr, type, mtime, "%s", buffer.c_str());

return bRC_OK;
}

static bRC bareosDebugMsg(bpContext *ctx, const char *file, int line,
int level, const char *fmt, ...)
{
va_list arg_ptr;
char buf[2000];
POOL_MEM buffer(PM_MESSAGE);

va_start(arg_ptr, fmt);
bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
buffer.bvsprintf(fmt, arg_ptr);
va_end(arg_ptr);
d_msg(file, line, level, "%s", buf);
d_msg(file, line, level, "%s", buffer.c_str());

return bRC_OK;
}

Expand Down

0 comments on commit 4bb54d0

Please sign in to comment.