summaryrefslogtreecommitdiff
path: root/src/socket-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-11 02:23:11 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-11 02:23:11 +0200
commitb12c1e7cf744a5e28db5a29e89377496893c1ab8 (patch)
tree722821c2505b3a18b660b1120ec994d2ae016d3d /src/socket-util.c
parentb574246b4f8e4eb86c29c38c7df47b541b68188a (diff)
socket: pass minimal abstract socket names
Diffstat (limited to 'src/socket-util.c')
-rw-r--r--src/socket-util.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/socket-util.c b/src/socket-util.c
index 5463ffbcbc..e6e3784bc5 100644
--- a/src/socket-util.c
+++ b/src/socket-util.c
@@ -101,7 +101,7 @@ int socket_address_parse(SocketAddress *a, const char *s) {
a->sockaddr.un.sun_family = AF_UNIX;
memcpy(a->sockaddr.un.sun_path+1, s+1, l);
- a->size = sizeof(struct sockaddr_un);
+ a->size = sizeof(sa_family_t) + 1 + l;
} else {
@@ -198,11 +198,7 @@ int socket_address_verify(const SocketAddress *a) {
if (a->size > sizeof(sa_family_t)) {
- if (a->sockaddr.un.sun_path[0] == 0) {
- /* abstract */
- if (a->size != sizeof(struct sockaddr_un))
- return -EINVAL;
- } else {
+ if (a->sockaddr.un.sun_path[0] != 0) {
char *e;
/* path */
@@ -437,7 +433,7 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) {
if (strncmp(a->sockaddr.un.sun_path, b->sockaddr.un.sun_path, sizeof(a->sockaddr.un.sun_path)) != 0)
return false;
} else {
- if (memcmp(a->sockaddr.un.sun_path, b->sockaddr.un.sun_path, sizeof(a->sockaddr.un.sun_path)) != 0)
+ if (memcmp(a->sockaddr.un.sun_path, b->sockaddr.un.sun_path, a->size) != 0)
return false;
}