summaryrefslogtreecommitdiff
path: root/udevd.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 /udevd.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 'udevd.c')
-rw-r--r--udevd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/udevd.c b/udevd.c
index 24cf9c9a7c..10d67f2c35 100644
--- a/udevd.c
+++ b/udevd.c
@@ -360,6 +360,7 @@ int main(int argc, char *argv[])
int csock;
struct sockaddr_un saddr;
struct sockaddr_un caddr;
+ socklen_t addrlen;
socklen_t clen;
pthread_t cli_tid;
pthread_t mgr_msg_tid;
@@ -379,6 +380,7 @@ 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;
ssock = socket(AF_LOCAL, SOCK_STREAM, 0);
if (ssock == -1) {
@@ -386,7 +388,7 @@ int main(int argc, char *argv[])
exit(1);
}
- retval = bind(ssock, &saddr, sizeof(saddr));
+ retval = bind(ssock, &saddr, addrlen);
if (retval < 0) {
dbg("bind failed\n");
goto exit;