diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-01-08 11:26:10 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-01-08 11:28:05 +0200 |
commit | 46b2745b25176c14c42bcc9612b290c310929aa0 (patch) | |
tree | c0b6357b82b00938896b75e516efe900212755c3 | |
parent | 06499f7e23e5ba528686c6135b02eafe6cb47817 (diff) | |
download | pies-46b2745b25176c14c42bcc9612b290c310929aa0.tar.gz pies-46b2745b25176c14c42bcc9612b290c310929aa0.tar.bz2 |
Bugfix
* lib/addrfmt.c (S_UN_NAME): Fix comparison.
(sockaddr_to_str): Improve wording.
-rw-r--r-- | lib/addrfmt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/addrfmt.c b/lib/addrfmt.c index ff615dd..bd468ef 100644 --- a/lib/addrfmt.c +++ b/lib/addrfmt.c | |||
@@ -77,7 +77,7 @@ _my_stpcpy (char **pbuf, size_t *psize, const char *src) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | #define S_UN_NAME(sa, salen) \ | 79 | #define S_UN_NAME(sa, salen) \ |
80 | ((salen < offsetof (struct sockaddr_un,sun_path)) ? "" : (sa)->sun_path) | 80 | ((salen <= offsetof (struct sockaddr_un,sun_path)) ? "" : (sa)->sun_path) |
81 | 81 | ||
82 | static size_t | 82 | static size_t |
83 | format_uint (char **bufptr, size_t *buflen, unsigned n) | 83 | format_uint (char **bufptr, size_t *buflen, unsigned n) |
@@ -140,8 +140,8 @@ sockaddr_to_str (const struct sockaddr *sa, int salen, | |||
140 | case AF_UNIX: | 140 | case AF_UNIX: |
141 | { | 141 | { |
142 | struct sockaddr_un *s_un = (struct sockaddr_un *)sa; | 142 | struct sockaddr_un *s_un = (struct sockaddr_un *)sa; |
143 | if (S_UN_NAME(s_un, salen)[0] == 0) | 143 | if (S_UN_NAME (s_un, salen)[0] == 0) |
144 | len += _my_stpcpy (&bufptr, &buflen, "anonymous socket"); | 144 | len += _my_stpcpy (&bufptr, &buflen, "somebody"); |
145 | else | 145 | else |
146 | { | 146 | { |
147 | len += _my_stpcpy (&bufptr, &buflen, "socket "); | 147 | len += _my_stpcpy (&bufptr, &buflen, "socket "); |