Kaynağa Gözat

Initialize error data structure with 0 if there is no error

If the client connect function is successfull, it did not fill out the error
data structure. However, some unit tests rely on this data being 0 (the old
implementation did reset it). Therefore we reset it to 0 again.
bel2125 3 yıl önce
ebeveyn
işleme
351bf60b13
1 değiştirilmiş dosya ile 10 ekleme ve 0 silme
  1. 10 0
      src/civetweb.c

+ 10 - 0
src/civetweb.c

@@ -17990,6 +17990,16 @@ mg_connect_client_impl(const struct mg_client_options *client_options,
 	    (struct mg_connection *)mg_calloc(1,
 	                                      conn_size + ctx_size + max_req_size);
 
+	if (error != NULL) {
+		if (error->text_buffer_size > 0) {
+			error->text[0] = 0;
+		}
+		if (error->code != NULL))
+			{
+				*error->code = MG_ERROR_DATA_CODE_OK;
+			}
+	}
+
 	if (conn == NULL) {
 		if ((error != NULL) && (error->text_buffer_size > 0)) {
 			mg_snprintf(NULL,