From 1736564b3212cffd3b12d7bca4cd78ba20ad1666 Mon Sep 17 00:00:00 2001 From: PsychoMario Date: Tue, 9 Dec 2014 23:26:00 +0000 Subject: [PATCH] error handling --- pxyconn.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pxyconn.c b/pxyconn.c index 2819332..e498696 100644 --- a/pxyconn.c +++ b/pxyconn.c @@ -864,10 +864,16 @@ pxy_srccert_create(pxy_conn_ctx_t *ctx) if (keyfd) { PEM_write_PrivateKey(keyfd, cert->key, NULL, 0, 0, NULL, NULL); fclose(keyfd); + } else { + log_err_printf("Failed to open '%s' for writing: %s\n", + keyfn, strerror(errno)); } if (crtfd) { PEM_write_X509(crtfd, cert->crt); fclose(crtfd); + } else { + log_err_printf("Failed to open '%s' for writing: %s\n", + keyfn, strerror(errno)); } if (ctx->opts->writeorig) { char *origfn; @@ -876,6 +882,9 @@ pxy_srccert_create(pxy_conn_ctx_t *ctx) if (origfd) { PEM_write_X509(origfd, ctx->origcrt); fclose(origfd); + } else { + log_err_printf("Failed to open '%s' for writing: %s\n", + keyfn, strerror(errno)); } } }