2 * Bacula message handling routines
4 * Kern Sibbald, April 2000
11 Copyright (C) 2000-2003 Kern Sibbald and John Walker
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of
16 the License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write to the Free
25 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
34 #define FULL_LOCATION 1 /* set for file:line in Debug messages */
37 * This is where we define "Globals" because all the
38 * daemons include this file.
40 char *working_directory = NULL; /* working directory path stored here */
41 int verbose = 0; /* increase User messages */
42 int debug_level = 0; /* debug level */
43 time_t daemon_start_time = 0; /* Daemon start time */
44 char *version = VERSION " (" BDATE ")";
45 char my_name[30]; /* daemon name is stored here */
46 char *exepath = (char *)NULL;
47 char *exename = (char *)NULL;
48 int console_msg_pending = 0;
49 char con_fname[500]; /* Console filename */
50 FILE *con_fd = NULL; /* Console file descriptor */
51 brwlock_t con_lock; /* Console lock structure */
52 FILE *trace_fd = NULL;
55 char catalog_db[] = "MySQL";
58 char catalog_db[] = "SQLite";
60 char catalog_db[] = "Internal";
64 char *host_os = HOST_OS;
65 char *distname = DISTNAME;
66 char *distver = DISTVER;
68 /* Forward referenced functions */
70 /* Imported functions */
75 static MSGS *daemon_msgs; /* global messages */
78 * Set daemon name. Also, find canonical execution
79 * path. Note, exepath has spare room for tacking on
80 * the exename so that we can reconstruct the full name.
82 * Note, this routine can get called multiple times
83 * The second time is to put the name as found in the
84 * Resource record. On the second call, generally,
85 * argv is NULL to avoid doing the path code twice.
87 #define BTRACE_EXTRA 20
88 void my_name_is(int argc, char *argv[], char *name)
91 char cpath[400], npath[400];
94 bstrncpy(my_name, name, sizeof(my_name));
95 if (argc>0 && argv && argv[0]) {
96 /* strip trailing filename and save exepath */
97 for (l=p=argv[0]; *p; p++) {
99 l = p; /* set pos of last slash */
107 /* On Windows allow c: junk */
117 exename = (char *)malloc(len);
123 exepath = (char *)malloc(strlen(argv[0]) + 1 + len);
124 for (p=argv[0],q=exepath; p < l; ) {
128 Dmsg1(200, "exepath=%s\n", exepath);
129 if (strchr(exepath, '.') || exepath[0] != '/') {
131 if (getcwd(cpath, sizeof(cpath))) {
132 if (chdir(exepath) == 0) {
133 if (!getcwd(npath, sizeof(npath))) {
140 exepath = (char *)malloc(strlen(npath) + 1 + len);
141 strcpy(exepath, npath);
144 Dmsg1(200, "Normalized exepath=%s\n", exepath);
150 * Initialize message handler for a daemon or a Job
151 * We make a copy of the MSGS resource passed, so it belows
152 * to the job or daemon and thus can be modified.
154 * NULL for jcr -> initialize global messages for daemon
155 * non-NULL -> initialize jcr using Message resource
158 init_msg(JCR *jcr, MSGS *msg)
160 DEST *d, *dnew, *temp_chain = NULL;
163 * If msg is NULL, initialize global chain for STDOUT and syslog
167 daemon_msgs = (MSGS *)malloc(sizeof(MSGS));
168 memset(daemon_msgs, 0, sizeof(MSGS));
169 for (i=1; i<=M_MAX; i++) {
170 add_msg_dest(daemon_msgs, MD_STDOUT, i, NULL, NULL);
171 add_msg_dest(daemon_msgs, MD_SYSLOG, i, NULL, NULL);
173 Dmsg1(050, "Create daemon global message resource 0x%x\n", daemon_msgs);
178 * Walk down the message resource chain duplicating it
179 * for the current Job.
181 for (d=msg->dest_chain; d; d=d->next) {
182 dnew = (DEST *)malloc(sizeof(DEST));
183 memcpy(dnew, d, sizeof(DEST));
184 dnew->next = temp_chain;
186 dnew->mail_filename = NULL;
188 dnew->mail_cmd = bstrdup(d->mail_cmd);
191 dnew->where = bstrdup(d->where);
197 jcr->jcr_msgs = (MSGS *)malloc(sizeof(MSGS));
198 memset(jcr->jcr_msgs, 0, sizeof(MSGS));
199 jcr->jcr_msgs->dest_chain = temp_chain;
200 memcpy(jcr->jcr_msgs->send_msg, msg->send_msg, sizeof(msg->send_msg));
202 /* If we have default values, release them now */
204 free_msgs_res(daemon_msgs);
206 daemon_msgs = (MSGS *)malloc(sizeof(MSGS));
207 memset(daemon_msgs, 0, sizeof(MSGS));
208 daemon_msgs->dest_chain = temp_chain;
209 memcpy(daemon_msgs->send_msg, msg->send_msg, sizeof(msg->send_msg));
211 Dmsg2(050, "Copy message resource 0x%x to 0x%x\n", msg, temp_chain);
215 /* Initialize so that the console (User Agent) can
216 * receive messages -- stored in a file.
218 void init_console_msg(char *wd)
222 bsnprintf(con_fname, sizeof(con_fname), "%s/%s.conmsg", wd, my_name);
223 fd = open(con_fname, O_CREAT|O_RDWR|O_BINARY, 0600);
225 Emsg2(M_ERROR_TERM, 0, _("Could not open console message file %s: ERR=%s\n"),
226 con_fname, strerror(errno));
228 if (lseek(fd, 0, SEEK_END) > 0) {
229 console_msg_pending = 1;
232 con_fd = fopen(con_fname, "a+");
234 Emsg2(M_ERROR, 0, _("Could not open console message file %s: ERR=%s\n"),
235 con_fname, strerror(errno));
237 if (rwl_init(&con_lock) != 0) {
238 Emsg1(M_ERROR_TERM, 0, _("Could not get con mutex: ERR=%s\n"),
244 * Called only during parsing of the config file.
246 * Add a message destination. I.e. associate a message type with
247 * a destination (code).
248 * Note, where in the case of dest_code FILE is a filename,
249 * but in the case of MAIL is a space separated list of
250 * email addresses, ...
252 void add_msg_dest(MSGS *msg, int dest_code, int msg_type, char *where, char *mail_cmd)
256 * First search the existing chain and see if we
257 * can simply add this msg_type to an existing entry.
259 for (d=msg->dest_chain; d; d=d->next) {
260 if (dest_code == d->dest_code && ((where == NULL && d->where == NULL) ||
261 (strcmp(where, d->where) == 0))) {
262 Dmsg4(200, "Add to existing d=%x msgtype=%d destcode=%d where=%s\n",
263 d, msg_type, dest_code, NPRT(where));
264 set_bit(msg_type, d->msg_types);
265 set_bit(msg_type, msg->send_msg); /* set msg_type bit in our local */
269 /* Not found, create a new entry */
270 d = (DEST *)malloc(sizeof(DEST));
271 memset(d, 0, sizeof(DEST));
272 d->next = msg->dest_chain;
273 d->dest_code = dest_code;
274 set_bit(msg_type, d->msg_types); /* set type bit in structure */
275 set_bit(msg_type, msg->send_msg); /* set type bit in our local */
277 d->where = bstrdup(where);
280 d->mail_cmd = bstrdup(mail_cmd);
282 Dmsg5(200, "add new d=%x msgtype=%d destcode=%d where=%s mailcmd=%s\n",
283 d, msg_type, dest_code, NPRT(where), NPRT(d->mail_cmd));
288 * Called only during parsing of the config file.
290 * Remove a message destination
292 void rem_msg_dest(MSGS *msg, int dest_code, int msg_type, char *where)
296 for (d=msg->dest_chain; d; d=d->next) {
297 Dmsg2(200, "Remove_msg_dest d=%x where=%s\n", d, NPRT(d->where));
298 if (bit_is_set(msg_type, d->msg_types) && (dest_code == d->dest_code) &&
299 ((where == NULL && d->where == NULL) ||
300 (strcmp(where, d->where) == 0))) {
301 Dmsg3(200, "Found for remove d=%x msgtype=%d destcode=%d\n",
302 d, msg_type, dest_code);
303 clear_bit(msg_type, d->msg_types);
304 Dmsg0(200, "Return rem_msg_dest\n");
310 static void make_unique_spool_filename(JCR *jcr, POOLMEM **name, int fd)
312 Mmsg(name, "%s/%s.spool.%s.%d", working_directory, my_name,
316 int open_spool_file(JCR *jcr, BSOCK *bs)
318 POOLMEM *name = get_pool_memory(PM_MESSAGE);
320 make_unique_spool_filename(jcr, &name, bs->fd);
321 bs->spool_fd = fopen(mp_chr(name), "w+");
323 Jmsg(jcr, M_ERROR, 0, "fopen spool file %s failed: ERR=%s\n", name, strerror(errno));
324 free_pool_memory(name);
327 free_pool_memory(name);
331 int close_spool_file(JCR *jcr, BSOCK *bs)
333 POOLMEM *name = get_pool_memory(PM_MESSAGE);
335 make_unique_spool_filename(jcr, &name, bs->fd);
336 fclose(bs->spool_fd);
337 unlink(mp_chr(name));
338 free_pool_memory(name);
345 * Create a unique filename for the mail command
347 static void make_unique_mail_filename(JCR *jcr, POOLMEM **name, DEST *d)
350 Mmsg(name, "%s/%s.mail.%s.%d", working_directory, my_name,
353 Mmsg(name, "%s/%s.mail.%s.%d", working_directory, my_name,
356 Dmsg1(200, "mailname=%s\n", *name);
362 static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM **cmd, DEST *d)
366 if (d->mail_cmd && jcr) {
367 *cmd = edit_job_codes(jcr, *cmd, d->mail_cmd, d->where);
369 Mmsg(cmd, "mail -s \"Bacula Message\" %s", d->where);
373 if (!(bpipe = open_bpipe(*cmd, 120, "rw"))) {
374 Jmsg(jcr, M_ERROR, 0, "open mail pipe %s failed: ERR=%s\n",
375 *cmd, strerror(errno));
381 * Close the messages for this Messages resource, which means to close
382 * any open files, and dispatch any pending email messages.
384 void close_msg(JCR *jcr)
392 Dmsg1(050, "Close_msg jcr=0x%x\n", jcr);
394 if (jcr == NULL) { /* NULL -> global chain */
397 msgs = jcr->jcr_msgs;
398 jcr->jcr_msgs = NULL;
403 Dmsg1(150, "===Begin close msg resource at 0x%x\n", msgs);
404 cmd = get_pool_memory(PM_MESSAGE);
405 for (d=msgs->dest_chain; d; ) {
407 switch (d->dest_code) {
411 fclose(d->fd); /* close open file descriptor */
415 case MD_MAIL_ON_ERROR:
416 Dmsg0(150, "Got MD_MAIL or MD_MAIL_ON_ERROR\n");
420 if (d->dest_code == MD_MAIL_ON_ERROR && jcr &&
421 jcr->JobStatus == JS_Terminated) {
425 if (!(bpipe=open_mail_pipe(jcr, &cmd, d))) {
426 Pmsg0(000, "open mail pipe failed.\n");
429 Dmsg0(150, "Opened mail pipe\n");
431 line = get_memory(len);
433 while (fgets(mp_chr(line), len, d->fd)) {
434 fputs(line, bpipe->wfd);
436 if (!close_wpipe(bpipe)) { /* close write pipe sending mail */
437 Pmsg1(000, "close error: ERR=%s\n", strerror(errno));
441 * Since we are closing all messages, before "recursing"
442 * make sure we are not closing the daemon messages, otherwise
445 if (msgs != daemon_msgs) {
446 /* read what mail prog returned -- should be nothing */
447 while (fgets(mp_chr(line), len, bpipe->rfd)) {
448 Jmsg1(jcr, M_INFO, 0, _("Mail prog: %s"), line);
452 stat = close_bpipe(bpipe);
453 if (stat != 0 && msgs != daemon_msgs) {
454 Dmsg1(150, "Calling emsg. CMD=%s\n", cmd);
455 Jmsg2(jcr, M_ERROR, 0, _("Mail program terminated in error. stat=%d\n"
456 "CMD=%s\n"), stat, cmd);
460 /* Remove temp file */
462 unlink(mp_chr(d->mail_filename));
463 free_pool_memory(d->mail_filename);
464 d->mail_filename = NULL;
465 Dmsg0(150, "end mail or mail on error\n");
472 d = d->next; /* point to next buffer */
474 free_pool_memory(cmd);
475 Dmsg0(150, "Done walking message chain.\n");
480 Dmsg0(150, "===End close msg resource\n");
484 * Free memory associated with Messages resource
486 void free_msgs_res(MSGS *msgs)
490 /* Walk down the message chain releasing allocated buffers */
491 for (d=msgs->dest_chain; d; ) {
498 old = d; /* save pointer to release */
499 d = d->next; /* point to next buffer */
500 free(old); /* free the destination item */
502 msgs->dest_chain = NULL;
503 free(msgs); /* free the head */
508 * Terminate the message handler for good.
509 * Release the global destination chain.
511 * Also, clean up a few other items (cons, exepath). Note,
512 * these really should be done elsewhere.
516 Dmsg0(100, "Enter term_msg\n");
517 close_msg(NULL); /* close global chain */
518 free_msgs_res(daemon_msgs); /* free the resources */
542 * Handle sending the message to the appropriate place
544 void dispatch_message(JCR *jcr, int type, int level, char *msg)
547 char dt[MAX_TIME_LENGTH];
553 Dmsg2(800, "Enter dispatch_msg type=%d msg=%s\n", type, msg);
555 if (type == M_ABORT || type == M_ERROR_TERM) {
556 fputs(msg, stdout); /* print this here to INSURE that it is printed */
559 /* Now figure out where to send the message */
562 msgs = jcr->jcr_msgs;
567 for (d=msgs->dest_chain; d; d=d->next) {
568 if (bit_is_set(type, d->msg_types)) {
569 switch (d->dest_code) {
571 Dmsg1(800, "CONSOLE for following msg: %s", msg);
573 con_fd = fopen(con_fname, "a+");
574 Dmsg0(800, "Console file not open.\n");
577 Pw(con_lock); /* get write lock on console message file */
579 bstrftime(dt, sizeof(dt), time(NULL));
582 fwrite(dt, len, 1, con_fd);
585 fwrite(msg, len, 1, con_fd);
586 if (msg[len-1] != '\n') {
587 fwrite("\n", 2, 1, con_fd);
590 fwrite("\n", 2, 1, con_fd);
593 console_msg_pending = TRUE;
598 Dmsg1(800, "SYSLOG for collowing msg: %s\n", msg);
600 * We really should do an openlog() here.
602 syslog(LOG_DAEMON|LOG_ERR, "%s", msg);
605 Dmsg1(800, "OPERATOR for collowing msg: %s\n", msg);
606 mcmd = get_pool_memory(PM_MESSAGE);
607 if ((bpipe=open_mail_pipe(jcr, &mcmd, d))) {
609 fputs(msg, bpipe->wfd);
610 /* Messages to the operator go one at a time */
611 stat = close_bpipe(bpipe);
613 Emsg1(M_ERROR, 0, _("Operator mail program terminated in error.\nCMD=%s\n"),
617 free_pool_memory(mcmd);
620 case MD_MAIL_ON_ERROR:
621 Dmsg1(800, "MAIL for following msg: %s", msg);
623 POOLMEM *name = get_pool_memory(PM_MESSAGE);
624 make_unique_mail_filename(jcr, &mp_chr(name), d);
625 d->fd = fopen(mp_chr(name), "w+");
628 Emsg2(M_ERROR, 0, "fopen %s failed: ERR=%s\n", name, strerror(errno));
630 free_pool_memory(name);
633 d->mail_filename = name;
636 if (len > d->max_len) {
637 d->max_len = len; /* keep max line length */
642 Dmsg1(800, "FILE for following msg: %s", msg);
644 d->fd = fopen(d->where, "w+");
647 Emsg2(M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno));
655 Dmsg1(800, "APPEND for following msg: %s", msg);
657 d->fd = fopen(d->where, "a");
660 Emsg2(M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno));
668 Dmsg1(800, "DIRECTOR for following msg: %s", msg);
669 if (jcr && jcr->dir_bsock && !jcr->dir_bsock->errors) {
671 jcr->dir_bsock->msglen = Mmsg(&(jcr->dir_bsock->msg),
672 "Jmsg Job=%s type=%d level=%d %s", jcr->Job,
673 type, level, msg) + 1;
674 bnet_send(jcr->dir_bsock);
678 Dmsg1(800, "STDOUT for following msg: %s", msg);
679 if (type != M_ABORT && type != M_ERROR_TERM) { /* already printed */
684 Dmsg1(800, "STDERR for following msg: %s", msg);
695 /*********************************************************************
697 * This subroutine prints a debug message if the level number
698 * is less than or equal the debug_level. File and line numbers
699 * are included for more detail if desired, but not currently
702 * If the level is negative, the details of file and line number
706 d_msg(char *file, int line, int level, char *fmt,...)
718 if (level <= debug_level) {
719 #ifdef SEND_DMSG_TO_FILE
721 bsnprintf(buf, sizeof(buf), "%s/bacula.trace", working_directory);
722 trace_fd = fopen(buf, "a+");
724 Emsg2(M_ABORT, 0, _("Cannot open %s: ERR=%s\n"),
725 buf, strerror(errno));
731 len = sprintf(buf, "%s: %s:%d ", my_name, file, line);
738 va_start(arg_ptr, fmt);
739 bvsnprintf(buf+len, sizeof(buf)-len, (char *)fmt, arg_ptr);
742 #ifdef SEND_DMSG_TO_FILE
743 fputs(buf, trace_fd);
752 /*********************************************************************
754 * This subroutine prints a message regardless of the debug level
756 * If the level is negative, the details of file and line number
760 p_msg(char *file, int line, int level, char *fmt,...)
768 len = sprintf(buf, "%s: %s:%d ", my_name, file, line);
775 va_start(arg_ptr, fmt);
776 bvsnprintf(buf+len, sizeof(buf)-len, (char *)fmt, arg_ptr);
782 /*********************************************************************
784 * subroutine writes a debug message to the trace file if the level number
785 * is less than or equal the debug_level. File and line numbers
786 * are included for more detail if desired, but not currently
789 * If the level is negative, the details of file and line number
793 t_msg(char *file, int line, int level, char *fmt,...)
805 if (level <= debug_level) {
807 bsnprintf(buf, sizeof(buf), "%s/bacula.trace", working_directory);
808 trace_fd = fopen(buf, "a+");
810 Emsg2(M_ABORT, 0, _("Cannot open %s: ERR=%s\n"),
811 buf, strerror(errno));
817 len = sprintf(buf, "%s: %s:%d ", my_name, file, line);
824 va_start(arg_ptr, fmt);
825 bvsnprintf(buf+len, sizeof(buf)-len, (char *)fmt, arg_ptr);
828 fputs(buf, trace_fd);
835 /* *********************************************************
837 * print an error message
841 e_msg(char *file, int line, int type, int level, char *fmt,...)
848 * Check if we have a message destination defined.
849 * We always report M_ABORT and M_ERROR_TERM
851 if (!daemon_msgs || ((type != M_ABORT && type != M_ERROR_TERM) &&
852 !bit_is_set(type, daemon_msgs->send_msg))) {
853 return; /* no destination */
857 len = sprintf(buf, "%s: ABORTING due to ERROR in %s:%d\n",
858 my_name, file, line);
861 len = sprintf(buf, "%s: ERROR TERMINATION at %s:%d\n",
862 my_name, file, line);
865 if (level == -1) /* skip details */
866 len = sprintf(buf, "%s: Fatal Error because: ", my_name);
868 len = sprintf(buf, "%s: Fatal Error at %s:%d because:\n", my_name, file, line);
871 if (level == -1) /* skip details */
872 len = sprintf(buf, "%s: Error: ", my_name);
874 len = sprintf(buf, "%s: Error in %s:%d ", my_name, file, line);
877 len = sprintf(buf, "%s: Warning: ", my_name);
880 len = sprintf(buf, "%s: ", my_name);
884 va_start(arg_ptr, fmt);
885 bvsnprintf(buf+len, sizeof(buf)-len, (char *)fmt, arg_ptr);
888 dispatch_message(NULL, type, level, buf);
890 if (type == M_ABORT) {
892 p[0] = 0; /* generate segmentation violation */
894 if (type == M_ERROR_TERM) {
899 /* *********************************************************
901 * Generate a Job message
905 Jmsg(JCR *jcr, int type, int level, char *fmt,...)
914 Dmsg1(800, "Enter Jmsg type=%d\n", type);
916 /* Special case for the console, which has a dir_bsock and JobId==0,
917 * in that case, we send the message directly back to the
920 if (jcr && jcr->JobId == 0 && jcr->dir_bsock) {
921 BSOCK *dir = jcr->dir_bsock;
922 va_start(arg_ptr, fmt);
923 dir->msglen = bvsnprintf(mp_chr(dir->msg), sizeof_pool_memory(dir->msg),
926 bnet_send(jcr->dir_bsock);
933 msgs = jcr->jcr_msgs;
937 msgs = daemon_msgs; /* if no jcr, we use daemon handler */
940 job = ""; /* Set null job name if none */
944 * Check if we have a message destination defined.
945 * We always report M_ABORT and M_ERROR_TERM
947 if (msgs && (type != M_ABORT && type != M_ERROR_TERM) &&
948 !bit_is_set(type, msgs->send_msg)) {
949 return; /* no destination */
953 len = sprintf(rbuf, "%s ABORTING due to ERROR\n", my_name);
956 len = sprintf(rbuf, "%s ERROR TERMINATION\n", my_name);
959 len = sprintf(rbuf, "%s: %s Fatal error: ", my_name, job);
961 set_jcr_job_status(jcr, JS_FatalError);
965 len = sprintf(rbuf, "%s: %s Error: ", my_name, job);
971 len = sprintf(rbuf, "%s: %s Warning: ", my_name, job);
974 len = sprintf(rbuf, "%s: ", my_name);
978 va_start(arg_ptr, fmt);
979 bvsnprintf(rbuf+len, sizeof(rbuf)-len, fmt, arg_ptr);
982 dispatch_message(jcr, type, level, rbuf);
984 if (type == M_ABORT){
986 p[0] = 0; /* generate segmentation violation */
988 if (type == M_ERROR_TERM) {
994 * Edit a message into a Pool memory buffer, with file:lineno
996 int m_msg(char *file, int line, POOLMEM **pool_buf, char *fmt, ...)
1001 i = sprintf(mp_chr(*pool_buf), "%s:%d ", file, line);
1004 maxlen = sizeof_pool_memory(*pool_buf) - i - 1;
1005 va_start(arg_ptr, fmt);
1006 len = bvsnprintf(*pool_buf+i, maxlen, fmt, arg_ptr);
1008 if (len < 0 || len >= maxlen) {
1009 *pool_buf = realloc_pool_memory(*pool_buf, maxlen + i + 200);
1016 * Edit a message into a Pool Memory buffer NO file:lineno
1017 * Returns: string length of what was edited.
1019 int Mmsg(POOLMEM **pool_buf, char *fmt, ...)
1025 maxlen = sizeof_pool_memory(*pool_buf) - 1;
1026 va_start(arg_ptr, fmt);
1027 len = bvsnprintf(*pool_buf, maxlen, fmt, arg_ptr);
1029 if (len < 0 || len >= maxlen) {
1030 *pool_buf = realloc_pool_memory(*pool_buf, maxlen + 200);
1038 * If we come here, prefix the message with the file:line-number,
1039 * then pass it on to the normal Jmsg routine.
1041 void j_msg(char *file, int line, JCR *jcr, int type, int level, char *fmt,...)
1047 pool_buf = get_pool_memory(PM_EMSG);
1048 i = sprintf(pool_buf, "%s:%d ", file, line);
1051 maxlen = sizeof_pool_memory(pool_buf) - i - 1;
1052 va_start(arg_ptr, fmt);
1053 len = bvsnprintf(pool_buf+i, maxlen, fmt, arg_ptr);
1055 if (len < 0 || len >= maxlen) {
1056 pool_buf = realloc_pool_memory(pool_buf, maxlen + i + 200);
1060 Jmsg(jcr, type, level, "%s", pool_buf);
1061 free_memory(pool_buf);