From: Jan Kiszka <
jan.k...@siemens.com>
Do not report success when there was none and consistently return 1 on
errors, not sometimes errno and sometimes 1.
Signed-off-by: Jan Kiszka <
jan.k...@siemens.com>
---
tools/bg_setenv.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index 9056102..6a68ba4 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -629,13 +629,14 @@ static int dumpenv_to_file(char *envfilepath) {
fprintf(stderr,
"Error writing to output file: %s\n",
strerror(errno));
- result = errno;
+ result = 1;
+ } else {
+ fprintf(stdout, "Output written to %s.\n", envfilepath);
}
if (fclose(of)) {
fprintf(stderr, "Error closing output file.\n");
- result = errno;
+ result = 1;
};
- fprintf(stdout, "Output written to %s.\n", envfilepath);
} else {
fprintf(stderr, "Error opening output file %s (%s).\n",
envfilepath, strerror(errno));
--
2.31.1