]> git.tue.mpg.de Git - paraslash.git/commitdiff
audioc: Get rid of the temporary socket file.
authorAndre Noll <maan@systemlinux.org>
Thu, 4 Oct 2007 18:48:35 +0000 (20:48 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 4 Oct 2007 18:48:35 +0000 (20:48 +0200)
This allows to kill the --tmpdir option as well.

audioc.c
audioc.ggo

index 66ff2a267dc5228056cce913055afc177f9c6560..0036da83144bc180d1f3df104f93e4276caaf1b7 100644 (file)
--- 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)
index be8ff62de9d99679f9a9e329d2384b5420df4eea..87ef71e3f73ba51320c71e8b682fc1efc90c4646 100644 (file)
@@ -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"