summaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-11-04 10:52:01 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-11-04 15:09:04 +0100
commit8082efd6deab856d21531f14aa32ae0eba4baacb (patch)
tree6f2100c82b7932e94d85f0f831feeb2ebfc3f6d6 /sources
parent2bc2490d00eb28574ddea6ea871842e8fe28469e (diff)
#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.
Diffstat (limited to 'sources')
-rw-r--r--sources/ogAdmServer.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp
index 025bfcd..ab8e5f5 100644
--- a/sources/ogAdmServer.cpp
+++ b/sources/ogAdmServer.cpp
@@ -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;