summaryrefslogtreecommitdiff
path: root/udevsend.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-02-06 00:11:24 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:32:25 -0700
commit1dadabd79b28a4cd72382abf746e9cf4c0589617 (patch)
tree5a869694b8b981f07c0a201c042689489277401d /udevsend.c
parent872344c41094f636fd667b9e619f8f219d814605 (diff)
[PATCH] udevd - fix socket path length
It seems that the guys are no longer differ about the right size of the socket address :) The kernel simply takes all bytes until the specified length as the name, so the real length should be enough.
Diffstat (limited to 'udevsend.c')
-rw-r--r--udevsend.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/udevsend.c b/udevsend.c
index 223647785d..246a097f26 100644
--- a/udevsend.c
+++ b/udevsend.c
@@ -29,6 +29,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
@@ -124,6 +125,7 @@ int main(int argc, char* argv[])
struct timespec tspec;
int sock;
struct sockaddr_un saddr;
+ socklen_t addrlen;
#ifdef DEBUG
init_logging("udevsend");
@@ -163,9 +165,10 @@ int main(int argc, char* argv[])
saddr.sun_family = AF_LOCAL;
/* use abstract namespace for socket path */
strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH);
+ addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1;
/* try to connect, if it fails start daemon */
- retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr));
+ retval = connect(sock, (struct sockaddr *) &saddr, addrlen);
if (retval != -1) {
goto send;
} else {