[Windows Agent] Fixed error on non cron configured modules

This commit is contained in:
fermin831 2018-02-22 13:51:10 +01:00
parent 94c1ce304d
commit 8e6e5480d2
2 changed files with 11 additions and 10 deletions

View File

@ -31,6 +31,15 @@
Cron::Cron (string cron_string) { Cron::Cron (string cron_string) {
char cron_params[5][256], bottom[256], top[256]; char cron_params[5][256], bottom[256], top[256];
// Check if cron string is the default or empty
if (
cron_string.compare(CRON_DEFAULT_STRING) == 0 ||
cron_string.compare("") == 0
) {
this->isSet = false;
return;
}
// Parse the cron string // Parse the cron string
if (sscanf (cron_string.c_str (), "%255s %255s %255s %255s %255s", cron_params[0], cron_params[1], cron_params[2], cron_params[3], cron_params[4]) != 5) { if (sscanf (cron_string.c_str (), "%255s %255s %255s %255s %255s", cron_params[0], cron_params[1], cron_params[2], cron_params[3], cron_params[4]) != 5) {
Pandora::pandoraDebug ("Invalid cron string: %s", cron_string.c_str ()); Pandora::pandoraDebug ("Invalid cron string: %s", cron_string.c_str ());
@ -41,12 +50,6 @@ Cron::Cron (string cron_string) {
this->cronString = cron_string; this->cronString = cron_string;
// Check if cron string is the default
if (cron_string.compare(CRON_DEFAULT_STRING) == 0) {
this->isSet = false;
return;
}
// Fill the cron structure // Fill the cron structure
this->utimestamp = 0; this->utimestamp = 0;
this->cronInterval = 0; this->cronInterval = 0;

View File

@ -1307,9 +1307,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
} }
/* Module cron */ /* Module cron */
if (module_crontab != "") {
module->setCron (module_crontab); module->setCron (module_crontab);
}
/* Plugins do not have a module type */ /* Plugins do not have a module type */
if (module_plugin == "") { if (module_plugin == "") {