From 20300c1fd5b35bf1d577a3726f02940d02c73f54 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Tue, 2 Apr 2019 13:30:33 +0200 Subject: Make sure that ISO19111 C++ code sets pj_errno on errors --- src/iso19111/c_api.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/iso19111/c_api.cpp') diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index b15b8e34..970d38d8 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -77,6 +77,11 @@ static void PROJ_NO_INLINE proj_log_error(PJ_CONTEXT *ctx, const char *function, msg += ": "; msg += text; ctx->logger(ctx->logger_app_data, PJ_LOG_ERROR, msg.c_str()); + auto previous_errno = pj_ctx_get_errno(ctx); + if (previous_errno == 0) { + // only set errno if it wasn't set deeper down the call stack + pj_ctx_set_errno(ctx, PJD_ERR_GENERIC_ERROR); + } } // --------------------------------------------------------------------------- -- cgit v1.2.3