regtest: remove compiler warnings with clang
[valgrind.git] / memcheck / tests / buflen_check.c
blob482d24d1bc415e71c7911998e9cf20bf52c19a1b
1 #include <sys/socket.h>
2 #include <stdlib.h>
3 #include <stdio.h>
5 int main(void)
7 struct sockaddr name;
8 int res1, res2, res3;
9 unsigned len = 10;
11 res1 = socket(PF_UNIX, SOCK_STREAM, 0);
12 if (res1 == 0) {
13 fprintf(stderr, "socket() failed\n");
14 exit(1);
17 /* Valgrind 1.0.X doesn't report the second error */
18 res2 = getsockname(res1, NULL, &len); /* NULL is bogus */
19 res3 = getsockname(res1, &name, NULL); /* NULL is bogus */
20 if (res2 == -1) {
21 fprintf(stderr, "getsockname(1) failed\n");
23 if (res3 == -1) {
24 fprintf(stderr, "getsockname(2) failed\n");
27 return 0;