#1051 Initialize task_id once in og_cmd_post_schedule_command

Fixes task_id re-initialization in commit 33d8cecfe.

Task id is to be initialized with the "session" value and can be done
out of the for loop it was before. Avoiding unnecesary snprintf's with
the same value.
master
Jose M. Guisado 2021-07-22 16:03:54 +02:00 committed by OpenGnSys Support Team
parent 261d490c4e
commit 8190c6f6df
1 changed files with 8 additions and 8 deletions

View File

@ -4848,16 +4848,16 @@ static int og_cmd_post_schedule_command(json_t *element,
goto err_dbi_result;
}
dbi_result_free(result);
len = snprintf(task_id, sizeof(sequence), "%d", sequence);
if (len >= (int)sizeof(task_id)) {
syslog(LOG_ERR, "truncated snprintf (%s:%d)\n",
__func__, __LINE__);
goto err_dbi;
}
params->task_id = task_id;
}
len = snprintf(task_id, sizeof(session), "%d", session);
if (len >= (int)sizeof(task_id)) {
syslog(LOG_ERR, "truncated snprintf (%s:%d)\n",
__func__, __LINE__);
goto err_dbi_result;
}
params->task_id = task_id;
og_task_schedule_create(params);
free((char *)legacy_params);