From 4a3ac8e0bc1fe4df353752fc5ed2386a8a0c6013 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 16 Jan 2022 21:28:21 +0100 Subject: [PATCH] exile_launch(): Improve handling/logging of errors --- exile.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exile.h b/exile.h index 502839e..d732c76 100644 --- a/exile.h +++ b/exile.h @@ -2133,17 +2133,19 @@ char *exile_launch_get(struct exile_launch_params *launch_params, size_t *n) { continue; } + EXILE_LOG_ERROR("Failed to read from read file descriptor\n"); + close(launch_result.read_fd); + fclose(stream); return NULL; } size_t written = fwrite(buffer, 1, ret, stream); if(written != (size_t) ret) { - if(ferror(stream)) - { - /* TODO: can we seek and free? */ - close(launch_result.read_fd); - return NULL; - } + EXILE_LOG_ERROR("Short item write"); + /* TODO: can we seek and free? */ + close(launch_result.read_fd); + fclose(stream); + return NULL; } } fclose(stream);