Skip to content

Commit 0678075

Browse files
committed
tests: fix maybe-uninitialized warning
Fixes: ``` [daniel@blanc:~/Code/Rust/rustls-ffi]$ make test gcc -o target/client.o -c tests/client.c -Werror -Wall -Wextra -Wpedantic -g -I src/ -O3 tests/client.c: In function ‘make_conn’: tests/client.c:70:5: error: ‘connect_result’ may be used uninitialized [-Werror=maybe-uninitialized] 70 | if(connect_result < 0) { | ^ tests/client.c:47:7: note: ‘connect_result’ was declared here 47 | int connect_result; | ^~~~~~~~~~~~~~ cc1: all warnings being treated as errors make: *** [Makefile:47: target/client.o] Error 1 ```
1 parent 65f45f3 commit 0678075

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/client.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ make_conn(const char *hostname, const char *port)
4444
goto cleanup;
4545
}
4646

47-
int connect_result;
47+
int connect_result = -1;
4848
for(int attempts = 0; attempts < 10; attempts++) {
4949
LOG("connect attempt %d", attempts);
5050
sockfd = socket(getaddrinfo_output->ai_family,

0 commit comments

Comments
 (0)