commit 5478cc19df38a4e8572c3c7bac3e91119782ec3a
parent 6c33d15d449ba161c55cad32454d453842ac5fec
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 9 Apr 2024 18:30:08 +0200
Update error handling when closing the test process
The return state of pclose is checked for errors. But errors were only
reported to the caller if it was the process that failed, ignoring the
error if it came from the pclose function itself. This commit corrects
this.
Diffstat:
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/sadist_external_flux.c b/src/sadist_external_flux.c
@@ -233,7 +233,7 @@ run(const char* command, const double ref)
/* Check command exit status */
if((status=pclose(output)), output=NULL, status) {
- if(WIFEXITED(status)) err = WEXITSTATUS(status);
+ err = WIFEXITED(status) ? WEXITSTATUS(status) : errno;
goto error;
}
diff --git a/src/sadist_probe_boundary.c b/src/sadist_probe_boundary.c
@@ -360,7 +360,7 @@ run1(const struct sadist_trilinear_profile* profile)
/* Check command exit status */
if((status=pclose(output), output=NULL, status)) {
- if(WIFEXITED(status)) err = WEXITSTATUS(status);
+ err = WIFEXITED(status) ? WEXITSTATUS(status) : errno;
goto error;
}
@@ -433,7 +433,7 @@ runN(const struct sadist_trilinear_profile* profile, const size_t nprobes)
/* Check command exit status */
if((status=pclose(output)), output = NULL, status) {
- if(WIFEXITED(status)) err = WEXITSTATUS(status);
+ err = WIFEXITED(status) ? WEXITSTATUS(status) : errno;
goto error;
}
output = NULL;
diff --git a/src/sadist_unsteady.c b/src/sadist_unsteady.c
@@ -70,8 +70,8 @@
#define COMMAND "stardis -V3 -p "STR(PX)","STR(PY)","STR(PZ)","STR(TIME) \
" -n "STR(NREALISATIONS)" -M "FILENAME_SCENE " -I -INF"
-#define COMMAND_DSPHERE COMMAND" -a dsphere"
-#define COMMAND_WOS COMMAND" -a wos"
+#define COMMAND_DSPHERE COMMAND" -a dsphere"
+#define COMMAND_WOS COMMAND" -a wos"
/*******************************************************************************
* Helper functions
@@ -185,7 +185,7 @@ run(struct sadist_unsteady_profile* profile, const char* command)
/* Check command exit status */
if((status=pclose(output), output=NULL, status)) {
- if(WIFEXITED(status)) err = WEXITSTATUS(status);
+ err = WIFEXITED(status) ? WEXITSTATUS(status) : errno;
goto error;
}