[Openvas-devel] Logic issue in pluginsheculer.c?
timon wang
timonwst at gmail.com
Sat Apr 23 04:33:29 CEST 2011
struct scheduler_plugin *
plugin_next_unrun_dependencie (plugins_scheduler_t sched,
struct hash ** dependencies_ptr,
int already_in_dependencie)
{
int flag = 0;
int counter = 0;
int i;
if(dependencies_ptr == NULL)
return NULL;
for(i=0;dependencies_ptr[i] != NULL;i++)
{
struct scheduler_plugin * plugin = dependencies_ptr[i]->plugin;
if(plugin != NULL)
{
int state = plugin_get_running_state(plugin);
switch(state)
{
case PLUGIN_STATUS_UNRUN :
{
struct hash ** deps_ptr = dependencies_ptr[i]->dependencies_ptr;
struct scheduler_plugin * ret;
counter ++;
if(deps_ptr == NULL)
return plugin;
else
{
ret = plugin_next_unrun_dependencie(sched, deps_ptr, 1);
if(ret == NULL)
return plugin;
else
if( ret == PLUG_RUNNING )
flag ++;
else
return ret;
}
case PLUGIN_STATUS_RUNNING:
flag++;
break;
case PLUGIN_STATUS_DONE:
scheduler_rm_running_ports(sched, plugin);
plugin_set_running_state(sched, plugin, PLUGIN_STATUS_DONE_AND_CLEANED);
break;
case PLUGIN_STATUS_DONE_AND_CLEANED:
break;
}
}
}
}
if(flag == 0)
return NULL;
else
return PLUG_RUNNING;
}
pluginsheculer.c: 415-471
In this function, I found that there are two branches will never be execute?
Can any body tell me if there is any condition makes these code run?
pluginsheculer.c: 456-461
case PLUGIN_STATUS_DONE:
scheduler_rm_running_ports(sched, plugin);
plugin_set_running_state(sched, plugin, PLUGIN_STATUS_DONE_AND_CLEANED);
break;
case PLUGIN_STATUS_DONE_AND_CLEANED:
break;
Is there any issue in the code listed below?
Timon Wang
my bolg: http://www.nohouse.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wald.intevation.org/pipermail/openvas-devel/attachments/20110423/0f31d1c9/attachment.htm
More information about the Openvas-devel
mailing list