From f647e3cf1e7f6782e18a6819d99e8f5731861dcd Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 30 Apr 2015 15:33:16 -0700 Subject: Uemis downloader: better error reporting Tell the user if Subsurface can't write to the req.txt file. Signed-off-by: Dirk Hohndel --- uemis-downloader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/uemis-downloader.c b/uemis-downloader.c index 7ffef58ed..20a01e527 100644 --- a/uemis-downloader.c +++ b/uemis-downloader.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "gettext.h" #include "libdivecomputer.h" @@ -440,6 +441,11 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in, int timeout = UEMIS_LONG_TIMEOUT; reqtxt_file = subsurface_open(reqtxt_path, O_RDWR | O_CREAT, 0666); + if (reqtxt_file == -1) { + *error_text = "can't open req.txt"; + fprintf(stderr, "open %s failed with errno %d\n", reqtxt_path, errno); + return false; + } snprintf(sb, BUFLEN, "n%04d12345678", filenr); str_append_with_delim(sb, request); for (i = 0; i < n_param_in; i++) -- cgit v1.2.3-70-g09d2