projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clarify copyright ownership for code authored by Etienne Dechamps.
[tinc]
/
src
/
sptps_test.c
diff --git
a/src/sptps_test.c
b/src/sptps_test.c
index
3ec9f98
..
1fb7f97
100644
(file)
--- a/
src/sptps_test.c
+++ b/
src/sptps_test.c
@@
-210,13
+210,13
@@
int main(int argc, char *argv[]) {
hint.ai_flags = initiator ? 0 : AI_PASSIVE;
if(getaddrinfo(initiator ? argv[3] : NULL, initiator ? argv[4] : argv[3], &hint, &ai) || !ai) {
hint.ai_flags = initiator ? 0 : AI_PASSIVE;
if(getaddrinfo(initiator ? argv[3] : NULL, initiator ? argv[4] : argv[3], &hint, &ai) || !ai) {
- fprintf(stderr, "getaddrinfo() failed: %s\n", s
trerror(
errno));
+ fprintf(stderr, "getaddrinfo() failed: %s\n", s
ockstrerror(sock
errno));
return 1;
}
int sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if(sock < 0) {
return 1;
}
int sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if(sock < 0) {
- fprintf(stderr, "Could not create socket: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not create socket: %s\n", s
ockstrerror(sock
errno));
return 1;
}
return 1;
}
@@
-225,26
+225,26
@@
int main(int argc, char *argv[]) {
if(initiator) {
if(connect(sock, ai->ai_addr, ai->ai_addrlen)) {
if(initiator) {
if(connect(sock, ai->ai_addr, ai->ai_addrlen)) {
- fprintf(stderr, "Could not connect to peer: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not connect to peer: %s\n", s
ockstrerror(sock
errno));
return 1;
}
fprintf(stderr, "Connected\n");
} else {
if(bind(sock, ai->ai_addr, ai->ai_addrlen)) {
return 1;
}
fprintf(stderr, "Connected\n");
} else {
if(bind(sock, ai->ai_addr, ai->ai_addrlen)) {
- fprintf(stderr, "Could not bind socket: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not bind socket: %s\n", s
ockstrerror(sock
errno));
return 1;
}
if(!datagram) {
if(listen(sock, 1)) {
return 1;
}
if(!datagram) {
if(listen(sock, 1)) {
- fprintf(stderr, "Could not listen on socket: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not listen on socket: %s\n", s
ockstrerror(sock
errno));
return 1;
}
fprintf(stderr, "Listening...\n");
sock = accept(sock, NULL, NULL);
if(sock < 0) {
return 1;
}
fprintf(stderr, "Listening...\n");
sock = accept(sock, NULL, NULL);
if(sock < 0) {
- fprintf(stderr, "Could not accept connection: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not accept connection: %s\n", s
ockstrerror(sock
errno));
return 1;
}
} else {
return 1;
}
} else {
@@
-255,12
+255,12
@@
int main(int argc, char *argv[]) {
socklen_t addrlen = sizeof addr;
if(recvfrom(sock, buf, sizeof buf, MSG_PEEK, &addr, &addrlen) <= 0) {
socklen_t addrlen = sizeof addr;
if(recvfrom(sock, buf, sizeof buf, MSG_PEEK, &addr, &addrlen) <= 0) {
- fprintf(stderr, "Could not read from socket: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not read from socket: %s\n", s
ockstrerror(sock
errno));
return 1;
}
if(connect(sock, &addr, addrlen)) {
return 1;
}
if(connect(sock, &addr, addrlen)) {
- fprintf(stderr, "Could not accept connection: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not accept connection: %s\n", s
ockstrerror(sock
errno));
return 1;
}
}
return 1;
}
}
@@
-331,7
+331,7
@@
int main(int argc, char *argv[]) {
if(FD_ISSET(sock, &fds)) {
ssize_t len = recv(sock, buf, sizeof buf, 0);
if(len < 0) {
if(FD_ISSET(sock, &fds)) {
ssize_t len = recv(sock, buf, sizeof buf, 0);
if(len < 0) {
- fprintf(stderr, "Could not read from socket: %s\n", s
trerror(
errno));
+ fprintf(stderr, "Could not read from socket: %s\n", s
ockstrerror(sock
errno));
return 1;
}
if(len == 0) {
return 1;
}
if(len == 0) {