From f8cbde54dab2783e2c6ba699dfaee9ef51b1e098 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 6 Jul 2004 00:08:44 +0000 Subject: auth support in esound and native AUTH and SET_NAME operatins in native simple library git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@51 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/module-protocol-stub.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/module-protocol-stub.c') diff --git a/src/module-protocol-stub.c b/src/module-protocol-stub.c index 1a655454..713e0ab8 100644 --- a/src/module-protocol-stub.c +++ b/src/module-protocol-stub.c @@ -1,3 +1,5 @@ +#include +#include #include #include #include @@ -50,13 +52,24 @@ int module_init(struct pa_core *c, struct pa_module*m) { assert(c && m); #ifdef USE_TCP_SOCKETS - if (!(s = pa_socket_server_new_ipv4(c->mainloop, INADDR_LOOPBACK, IPV4_PORT))) + if (!(s = pa_socket_server_new_ipv4(c->mainloop, INADDR_ANY, IPV4_PORT))) return -1; #else if (pa_make_secure_dir(UNIX_SOCKET_DIR) < 0) { fprintf(stderr, "Failed to create secure socket directory.\n"); return -1; } + + { + int r; + if ((r = pa_unix_socket_remove_stale(UNIX_SOCKET)) < 0) { + fprintf(stderr, "Failed to remove stale UNIX socket '%s': %s\n", UNIX_SOCKET, strerror(errno)); + return -1; + } + + if (r) + fprintf(stderr, "Removed stale UNIX socket '%s'.", UNIX_SOCKET); + } if (!(s = pa_socket_server_new_unix(c->mainloop, UNIX_SOCKET))) { rmdir(UNIX_SOCKET_DIR); @@ -69,8 +82,12 @@ int module_init(struct pa_core *c, struct pa_module*m) { #else m->userdata = protocol_new(c, s); #endif - - assert(m->userdata); + + if (!m->userdata) { + pa_socket_server_free(s); + return -1; + } + return 0; } -- cgit