mirror of https://git.48k.eu/ogserver
#924 Always check the result of a command to avoid errors
Irina reports that if you try to restore an image without success (for example: the disk does not have enough space), the database changes as if no error would happen. So you see the computer in the WebConsole with an image/OS that, actually, does not have. The bug is caused because the function respuestaEstandar only checks the result of a command if it has a session. So the problem is that the commands which use respuestaEstandar without a session can return an error, but the ogAdmServer always works as no error would occur. This commit changes the behaviour of respuestaEstadar to always check the result of a command, whether it has a session or not.master
parent
2bc2490d00
commit
8082efd6de
|
@ -1068,13 +1068,25 @@ static bool respuestaEstandar(TRAMA *ptrTrama, char *iph, char *ido, Database db
|
|||
struct tm* st;
|
||||
int idaccion;
|
||||
|
||||
ids = copiaParametro("ids",ptrTrama); // Toma identificador de la sesión
|
||||
ids = copiaParametro("ids",ptrTrama);
|
||||
res = copiaParametro("res",ptrTrama);
|
||||
|
||||
if (ids == NULL) // No existe seguimiento de la acción
|
||||
if (ids == NULL) {
|
||||
if (atoi(res) == ACCION_FALLIDA) {
|
||||
liberaMemoria(res);
|
||||
return false;
|
||||
}
|
||||
liberaMemoria(res);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (atoi(ids) == 0){ // No existe seguimiento de la acción
|
||||
if (atoi(ids) == 0) {
|
||||
liberaMemoria(ids);
|
||||
if (atoi(res) == ACCION_FALLIDA) {
|
||||
liberaMemoria(res);
|
||||
return false;
|
||||
}
|
||||
liberaMemoria(res);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1103,7 +1115,6 @@ static bool respuestaEstandar(TRAMA *ptrTrama, char *iph, char *ido, Database db
|
|||
sprintf(fechafin, "%d/%d/%d %d:%d:%d", st->tm_year + 1900, st->tm_mon + 1,
|
||||
st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec);
|
||||
|
||||
res = copiaParametro("res",ptrTrama); // Toma resultado
|
||||
der = copiaParametro("der",ptrTrama); // Toma descripción del error (si hubiera habido)
|
||||
|
||||
sprintf(sqlstr,
|
||||
|
@ -1121,11 +1132,6 @@ static bool respuestaEstandar(TRAMA *ptrTrama, char *iph, char *ido, Database db
|
|||
}
|
||||
|
||||
liberaMemoria(der);
|
||||
|
||||
if (atoi(res) == ACCION_FALLIDA) {
|
||||
liberaMemoria(res);
|
||||
return false; // Error en la ejecución del comando
|
||||
}
|
||||
|
||||
liberaMemoria(res);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue