summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/test-dns.c
diff options
context:
space:
mode:
authorDaniel Buch <boogiewasthere@gmail.com>2014-01-12 19:42:33 +0100
committerTom Gundersen <teg@jklm.no>2014-01-13 00:08:42 +0100
commit8e50b5a77cd980ee57e0f75c59d0012d8df9a4f2 (patch)
treecf9b97bb1600fd7947771f5e7141371fd93a1ab3 /src/libsystemd-bus/test-dns.c
parentf3621dec5234757a8424b90431b681853e9effa2 (diff)
sd-dns: coding style cleanup
Diffstat (limited to 'src/libsystemd-bus/test-dns.c')
-rw-r--r--src/libsystemd-bus/test-dns.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libsystemd-bus/test-dns.c b/src/libsystemd-bus/test-dns.c
index 3e326ba071..b4f064f2fd 100644
--- a/src/libsystemd-bus/test-dns.c
+++ b/src/libsystemd-bus/test-dns.c
@@ -56,7 +56,6 @@ int main(int argc, char *argv[]) {
hints.ai_socktype = SOCK_STREAM;
q1 = asyncns_getaddrinfo(asyncns, argc >= 2 ? argv[1] : "www.heise.de", NULL, &hints);
-
if (!q1)
fprintf(stderr, "asyncns_getaddrinfo(): %s\n", strerror(errno));
@@ -66,27 +65,25 @@ int main(int argc, char *argv[]) {
sa.sin_port = htons(80);
q2 = asyncns_getnameinfo(asyncns, (struct sockaddr*) &sa, sizeof(sa), 0, 1, 1);
-
if (!q2)
fprintf(stderr, "asyncns_getnameinfo(): %s\n", strerror(errno));
/* Make a res_query() call */
q3 = asyncns_res_query(asyncns, "_xmpp-client._tcp.gmail.com", C_IN, T_SRV);
-
if (!q3)
fprintf(stderr, "asyncns_res_query(): %s\n", strerror(errno));
/* Wait until the three queries are completed */
- while (!asyncns_isdone(asyncns, q1)
- || !asyncns_isdone(asyncns, q2)
- || !asyncns_isdone(asyncns, q3)) {
- if (asyncns_wait(asyncns, 1) < 0) {
+ while (!asyncns_isdone(asyncns, q1) ||
+ !asyncns_isdone(asyncns, q2) ||
+ !asyncns_isdone(asyncns, q3)) {
+ if (asyncns_wait(asyncns, 1) < 0)
fprintf(stderr, "asyncns_wait(): %s\n", strerror(errno));
- }
}
/* Interpret the result of the name -> addr query */
- if ((ret = asyncns_getaddrinfo_done(asyncns, q1, &ai)))
+ ret = asyncns_getaddrinfo_done(asyncns, q1, &ai);
+ if (ret)
fprintf(stderr, "error: %s %i\n", gai_strerror(ret), ret);
else {
struct addrinfo *i;
@@ -105,13 +102,15 @@ int main(int argc, char *argv[]) {
}
/* Interpret the result of the addr -> name query */
- if ((ret = asyncns_getnameinfo_done(asyncns, q2, host, sizeof(host), serv, sizeof(serv))))
+ ret = asyncns_getnameinfo_done(asyncns, q2, host, sizeof(host), serv, sizeof(serv));
+ if (ret)
fprintf(stderr, "error: %s %i\n", gai_strerror(ret), ret);
else
printf("%s -- %s\n", host, serv);
/* Interpret the result of the SRV lookup */
- if ((ret = asyncns_res_done(asyncns, q3, &srv)) < 0) {
+ ret = asyncns_res_done(asyncns, q3, &srv);
+ if (ret < 0) {
fprintf(stderr, "error: %s %i\n", strerror(errno), ret);
} else if (ret == 0) {
fprintf(stderr, "No reply for SRV lookup\n");