int result;
Dmsg0(120, "bdird: sending runscripts to fd\n");
-
+ if (!jcr->job->RunScripts) {
+ goto norunscript;
+ }
foreach_alist(cmd, jcr->job->RunScripts) {
if (cmd->can_run_at_level(jcr->getJobLevel()) && cmd->target) {
ehost = edit_job_codes(jcr, ehost, cmd->target, "");
goto bail_out;
}
}
+norunscript:
free_pool_memory(msg);
free_pool_memory(ehost);
return 1;
return false;
}
- while (ua->jcr->wstorage->size()) {
- ua->jcr->wstorage->remove(0);
+ if (ua->jcr->wstorage) {
+ while (ua->jcr->wstorage->size()) {
+ ua->jcr->wstorage->remove(0);
+ }
}
len = strlen(ua->argk[0]);
ua->send_msg("sdport=%d", storage->SDport);
device = (DEVICE *)storage->device->first();
ua->send_msg("device=%s", device->name());
- if (storage->device->size() > 1) {
+ if (storage->device && storage->device->size() > 1) {
while ((device = (DEVICE *)storage->device->next())) {
ua->send_msg(",%s", device->name());
}
edit_uint64_with_commas(sm_max_buffers, b5));
/* TODO: use this function once for all daemons */
- if (b_plugin_list->size() > 0) {
+ if (b_plugin_list && b_plugin_list->size() > 0) {
int len;
Plugin *plugin;
POOL_MEM msg(PM_FNAME);
edit_uint64(debug_level, b2), get_trace(), (int)DEVELOPER_MODE,
edit_uint64_with_commas(me->max_bandwidth_per_job/1024, b1));
sendit(msg.c_str(), len, sp);
- if (b_plugin_list->size() > 0) {
+ if (b_plugin_list && b_plugin_list->size() > 0) {
Plugin *plugin;
int len;
pm_strcpy(msg, " Plugin: ");
inline bool alist::empty() const
{
- /* Check for null pointer */
- return this ? num_items == 0 : true;
+ return num_items == 0;
}
/*
* on size to succeed even if nothing put in
* alist.
*/
- return this ? num_items : 0;
+ return num_items;
}
/* How much to grow by each time */
*/
void free_bregexps(alist *bregexps)
{
- Dmsg0(500, "bregexp: freeing all BREGEXP object\n");
-
BREGEXP *elt;
+ Dmsg0(500, "bregexp: freeing all BREGEXP object\n");
+ if (!bregexps) {
+ return;
+ }
foreach_alist(elt, bregexps) {
free_bregexp(elt);
}
fd_set fdset;
struct timeval tv;
- if (this == NULL) {
- return -1;
- }
FD_ZERO(&fdset);
FD_SET((unsigned)m_fd, &fdset);
tv.tv_sec = sec;
int loaded;
int i;
- if (!changer) {
+ if (!changer || !changer->device) {
return false;
}
if (changer->device->size() == 1) {
if (strcasecmp(cmd, "drives") == 0) {
AUTOCHANGER *changer_res = dcr->device->changer_res;
int drives = 1;
- if (changer_res) {
+ if (changer_res && changer_res->device) {
drives = changer_res->device->size();
}
dir->fsend("drives=%d\n", drives);
static void list_plugins(STATUS_PKT *sp)
{
POOL_MEM msg(PM_MESSAGE);
- if (b_plugin_list->size() > 0) {
+ if (b_plugin_list && b_plugin_list->size() > 0) {
Plugin *plugin;
int len;
pm_strcpy(msg, " Plugin: ");
my_timezone = tz_offset(now, tm);
strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S", &tm);
- snprintf(tzbuf, sizeof(tzbuf), " %+2.2ld%2.2u", -my_timezone / 60, abs(my_timezone) % 60);
+ snprintf(tzbuf, sizeof(tzbuf), " %+2.2ld%2.2u", -my_timezone / 60, (unsigned int)abs(my_timezone) % 60);
strcat(buf, tzbuf); /* add +0100 */
strftime(tzbuf, sizeof(tzbuf), " (%Z)", &tm);
strcat(buf, tzbuf); /* add (CEST) */