This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <config.h>
18
19 #include <sys/socket.h>
20
21 #include "signature.h"
22 SIGNATURE_CHECK (getpeername, int, (int, struct sockaddr *, socklen_t *));
23
24 #include <errno.h>
25 #include <netinet/in.h>
26 #include <unistd.h>
27
28 #include "sockets.h"
29 #include "macros.h"
30
31 int
32 main (void)
33 {
34 (void) gl_sockets_startup (SOCKETS_1_1);
35
36
37 {
38 struct sockaddr_in addr;
39 socklen_t addrlen = sizeof (addr);
40
41 errno = 0;
42 ASSERT (getpeername (-1, (struct sockaddr *) &addr, &addrlen) == -1);
43 ASSERT (errno == EBADF);
44 }
45 {
46 struct sockaddr_in addr;
47 socklen_t addrlen = sizeof (addr);
48
49 close (99);
50 errno = 0;
51 ASSERT (getpeername (99, (struct sockaddr *) &addr, &addrlen) == -1);
52 ASSERT (errno == EBADF);
53 }
54
55 return 0;
56 }