chiark / gitweb /
sd-resolve: use different element of union to make code more readable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 14 Mar 2015 02:11:05 +0000 (21:11 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 14 Mar 2015 03:42:17 +0000 (23:42 -0400)
They both point to the same location, but the reader
is not forced to look back to the beginning of the function
to see that.

src/libsystemd/sd-resolve/sd-resolve.c

index ca517861d9a09eaea7c4255b1f1ce462e98d7506..8aec75aa47eaab996ec0c7ab6a828fbc716f4892 100644 (file)
@@ -450,7 +450,7 @@ static int handle_request(int out_fd, const Packet *packet, size_t length) {
                  assert(length >= sizeof(ResRequest));
                  assert(length == sizeof(ResRequest) + res_req->dname_len);
 
                  assert(length >= sizeof(ResRequest));
                  assert(length == sizeof(ResRequest) + res_req->dname_len);
 
-                 dname = (const char *) req + sizeof(ResRequest);
+                 dname = (const char *) res_req + sizeof(ResRequest);
 
                  if (req->type == REQUEST_RES_QUERY)
                          ret = res_query(dname, res_req->class, res_req->type, (unsigned char *) &answer, BUFSIZE);
 
                  if (req->type == REQUEST_RES_QUERY)
                          ret = res_query(dname, res_req->class, res_req->type, (unsigned char *) &answer, BUFSIZE);