summaryrefslogtreecommitdiff
path: root/udevd.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-02-05 01:35:15 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:32:25 -0700
commit872344c41094f636fd667b9e619f8f219d814605 (patch)
tree474af8cb42f203db83c39847d3a6bd11b2b7c8a2 /udevd.c
parent86590cd590a9f2fcc5917e8f5c85e024af1e58e0 (diff)
[PATCH] udevd - switch socket path to abstract namespace
As Chris Friesen <chris_friesen@sympatico.ca> suggested, here we switch the unix domains socket path to abstract namespace and get rid of the socket file in the filesystem. Hey, this was new to me today. So here a few words: Linux supports a abstract namespace for sockets. We don't need a physical file on the filesystem but only a unique string magically starting with the '\0' character. strace with real file: connect(3, {sa_family=AF_UNIX, path="/udev/.udevd.sock"}, 110) strace with abstract namespace: connect(3, {sa_family=AF_UNIX, path=@udevd}, 110)
Diffstat (limited to 'udevd.c')
-rw-r--r--udevd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/udevd.c b/udevd.c
index f8b8c27ee4..24cf9c9a7c 100644
--- a/udevd.c
+++ b/udevd.c
@@ -325,7 +325,6 @@ static void sig_handler(int signum)
case SIGINT:
case SIGTERM:
unlink(UDEVD_LOCK);
- unlink(UDEVD_SOCK);
exit(20 + signum);
break;
default:
@@ -378,9 +377,9 @@ int main(int argc, char *argv[])
memset(&saddr, 0x00, sizeof(saddr));
saddr.sun_family = AF_LOCAL;
- strcpy(saddr.sun_path, UDEVD_SOCK);
+ /* use abstract namespace for socket path */
+ strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH);
- unlink(UDEVD_SOCK);
ssock = socket(AF_LOCAL, SOCK_STREAM, 0);
if (ssock == -1) {
dbg("error getting socket");
@@ -426,6 +425,5 @@ int main(int argc, char *argv[])
}
exit:
close(ssock);
- unlink(UDEVD_SOCK);
exit(1);
}