summaryrefslogtreecommitdiff
path: root/examples/example-ssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example-ssl.c')
-rw-r--r--examples/example-ssl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/example-ssl.c b/examples/example-ssl.c
index b8ca442..6d1e32e 100644
--- a/examples/example-ssl.c
+++ b/examples/example-ssl.c
@@ -12,7 +12,7 @@
int main(int argc, char **argv) {
unsigned int j;
redisSSLContext *ssl;
- redisSSLContextError ssl_error;
+ redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE;
redisContext *c;
redisReply *reply;
if (argc < 4) {
@@ -27,9 +27,8 @@ int main(int argc, char **argv) {
redisInitOpenSSL();
ssl = redisCreateSSLContext(ca, NULL, cert, key, NULL, &ssl_error);
- if (!ssl) {
- printf("SSL Context error: %s\n",
- redisSSLContextGetError(ssl_error));
+ if (!ssl || ssl_error != REDIS_SSL_CTX_NONE) {
+ printf("SSL Context error: %s\n", redisSSLContextGetError(ssl_error));
exit(1);
}