[systemd-devel] [PATCH] fix compiler warning

Shawn Landden shawn at churchofgit.com
Tue Mar 10 20:42:55 PDT 2015


warning: pointer/integer type mismatch in conditional expression
---
 src/shared/socket-util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index 5820279..73e1177 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -475,8 +475,8 @@ int sockaddr_port(const struct sockaddr *_sa) {
                 return -EAFNOSUPPORT;
 
         return ntohs(sa->sa.sa_family == AF_INET6 ?
-                       sa->in6.sin6_port :
-                       sa->in.sin_port);
+                       (uint16_t)sa->in6.sin6_port :
+                       (uint16_t)sa->in.sin_port);
 }
 
 int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret) {
-- 
2.2.1.209.g41e5f3a



More information about the systemd-devel mailing list