summaryrefslogtreecommitdiffstats
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
commit78a97c59c8304e8b5d6eef4cccaeb740d5bc56ce (patch)
treeb74edaab971936ca9adcbcbaf93cb198b8c108cf
parenta445889f0eb0200a01954039338fba7f20328ac4 (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.
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp
index 025bfcd1..ab8e5f50 100644
--- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp
+++ b/admin/Sources/Services/ogAdmServer/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;