MCPcopy Create free account
hub / github.com/axboe/liburing / check_sockaddr

Function check_sockaddr

test/recv-multishot.c:36–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34};
35
36static int check_sockaddr(struct sockaddr_in *in)
37{
38 struct in_addr expected;
39
40 inet_pton(AF_INET, "127.0.0.1", &expected);
41 if (in->sin_family != AF_INET) {
42 fprintf(stderr, "bad family %d\n", (int)htons(in->sin_family));
43 return -1;
44 }
45 if (memcmp(&expected, &in->sin_addr, sizeof(in->sin_addr))) {
46 char buff[256];
47 const char *addr = inet_ntop(AF_INET, &in->sin_addr, buff, sizeof(buff));
48
49 fprintf(stderr, "unexpected address %s\n", addr ? addr : "INVALID");
50 return -1;
51 }
52 return 0;
53}
54
55static int test(struct args *args)
56{

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected