Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Knot DNS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
23
Issues
23
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Knot projects
Knot DNS
Commits
d735f7c3
Commit
d735f7c3
authored
Apr 07, 2015
by
Jan Včelák
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/net_shortwrite: fix execution on OpenBSD
parent
bfa67283
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
tests/net_shortwrite.c
tests/net_shortwrite.c
+18
-3
No files found.
tests/net_shortwrite.c
View file @
d735f7c3
...
...
@@ -21,10 +21,27 @@
#include <string.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include "libknot/internal/net.h"
const
struct
timeval
TIMEOUT
=
{
.
tv_sec
=
1
};
static
struct
sockaddr_storage
localhost
(
void
)
{
struct
sockaddr_storage
addr
=
{
0
};
struct
addrinfo
*
res
=
NULL
;
if
(
getaddrinfo
(
NULL
,
"0"
,
NULL
,
&
res
)
==
0
)
{
memcpy
(
&
addr
,
res
->
ai_addr
,
res
->
ai_addrlen
);
freeaddrinfo
(
res
);
}
return
addr
;
}
struct
data
{
int
fd
;
struct
timeval
timeout
;
...
...
@@ -47,9 +64,7 @@ int main(int argc, char *argv[])
int
r
;
// create TCP server
struct
sockaddr_storage
addr
=
{
0
};
addr
.
ss_family
=
AF_INET
;
struct
sockaddr_storage
addr
=
localhost
();
int
server
=
net_bound_socket
(
SOCK_STREAM
,
&
addr
,
0
);
ok
(
server
>=
0
,
"server: bind socket"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment