From: Andre Noll Date: Thu, 4 Oct 2007 18:48:35 +0000 (+0200) Subject: audioc: Get rid of the temporary socket file. X-Git-Tag: v0.3.0~309 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=5dacd7f03bbed65aaa400e7372e01de2c652c925;p=paraslash.git audioc: Get rid of the temporary socket file. This allows to kill the --tmpdir option as well. --- diff --git a/audioc.c b/audioc.c index 66ff2a26..0036da83 100644 --- a/audioc.c +++ b/audioc.c @@ -67,11 +67,10 @@ static char *configfile_exists(void) */ int main(int argc, char *argv[]) { - struct sockaddr_un unix_addr; int ret = -E_AUDIOC_SYNTAX, fd; - char *cf, *socket_name, *randname = para_tmpname(), *tmpsocket_name = NULL, - *buf = NULL, *hn = para_hostname(), *args, *home = para_homedir(); + char *cf, *buf = NULL, *args; size_t bufsize, loaded = 0; + struct sockaddr_un unix_addr; if (audioc_cmdline_parser(argc, argv, &conf)) goto out; @@ -94,26 +93,20 @@ int main(int argc, char *argv[]) para_strdup("stat"); bufsize = conf.bufsize_arg; buf = para_malloc(bufsize); - if (conf.socket_given) - socket_name = para_strdup(conf.socket_arg); - else - socket_name = make_message( - "/var/paraslash/audiod_socket.%s", hn); - if (conf.tmpdir_given) - tmpsocket_name = make_message("%s/audioc.sock.%s.%s", - conf.tmpdir_arg, hn, randname); - else - tmpsocket_name = make_message("%s/.paraslash/audioc_sock.%s.%s", - home, hn, randname); - - ret = create_local_socket(tmpsocket_name, &unix_addr, S_IRUSR | S_IWUSR); - unlink(tmpsocket_name); - free(tmpsocket_name); + ret = get_stream_socket(PF_UNIX); if (ret < 0) goto out; fd = ret; - ret = -E_INIT_SOCK_ADDR; - if (init_unix_addr(&unix_addr, socket_name) < 0) + if (conf.socket_given) + ret = init_unix_addr(&unix_addr, conf.socket_arg); + else { + char *hn = para_hostname(), *socket_name = make_message( + "/var/paraslash/audiod_socket.%s", hn); + free(hn); + ret = init_unix_addr(&unix_addr, socket_name); + free(socket_name); + } + if (ret < 0) goto out; ret = PARA_CONNECT(fd, &unix_addr); if (ret < 0) diff --git a/audioc.ggo b/audioc.ggo index be8ff62d..87ef71e3 100644 --- a/audioc.ggo +++ b/audioc.ggo @@ -13,13 +13,6 @@ option "socket" s optional -option "tmpdir" d -#~~~~~~~~~~~~~~~~ -"directory for temporary socket (default=~/.paraslash)" - string typestr="dirname" - optional - - option "bufsize" b #~~~~~~~~~~~~~~~~~ "size of internal buffer"