Browse Source

Example: Test if OpenSSL init was successful

bel2125 3 năm trước cách đây
mục cha
commit
2319c5f5f2
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      examples/embed_certificate/ec_example.c

+ 5 - 1
examples/embed_certificate/ec_example.c

@@ -316,7 +316,11 @@ request_handler(struct mg_connection *conn, void *cbdata)
 int
 main(int argc, char *argv[])
 {
-	mg_init_library(MG_FEATURES_TLS);
+	int ret = mg_init_library(MG_FEATURES_TLS);
+	if (ret != MG_FEATURES_TLS) {
+		printf("Initializing SSL libraries failed\n");
+		return 1;
+	}
 
 	printf("Starting example server at https://localhost:443/\n");
 	struct mg_init_data init = {0};