Skip to content

Commit

Permalink
odbc: Make init_fake_server more similars
Browse files Browse the repository at this point in the history
TODO, reuse

Signed-off-by: Frediano Ziglio <[email protected]>
  • Loading branch information
freddy77 committed Dec 12, 2024
1 parent 9694e27 commit 10cde49
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/odbc/unittests/timeout3.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ init_fake_server(int ip_port)
{
struct sockaddr_in sin;
TDS_SYS_SOCKET s;
int err;

memset(&sin, 0, sizeof(sin));
sin.sin_addr.s_addr = INADDR_ANY;
Expand All @@ -66,9 +65,12 @@ init_fake_server(int ip_port)
CLOSESOCKET(s);
return 1;
}
listen(s, 5);
err = tds_thread_create(&fake_thread, fake_thread_proc, TDS_INT2PTR(s));
if (err != 0) {
if (listen(s, 5) < 0) {
perror("listen");
CLOSESOCKET(s);
return 1;
}
if (tds_thread_create(&fake_thread, fake_thread_proc, TDS_INT2PTR(s)) != 0) {
perror("tds_thread_create");
exit(1);
}
Expand Down

0 comments on commit 10cde49

Please sign in to comment.