/*
- * Copyright (C) 2005-2012 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
out:
if (ret < 0) {
free(buf);
- btr_remove_node(at->btrn);
- btr_free_node(at->btrn);
- at->btrn = NULL;
+ btr_remove_node(&at->btrn);
close(at->fd);
}
t->error = ret;
static char *configfile_exists(void)
{
- static char *config_file;
+ char *config_file;
struct stat statbuf;
+ char *home = para_homedir();
- if (!config_file) {
- char *home = para_homedir();
- config_file = make_message("%s/.paraslash/audioc.conf", home);
- free(home);
- }
+ config_file = make_message("%s/.paraslash/audioc.conf", home);
+ free(home);
if (!stat(config_file, &statbuf))
return config_file;
+ free(config_file);
return NULL;
}
* \param argc Usual argument count.
* \param argv Usual argument vector.
*
- * It creates a temporary local socket in order to communicate with para_audiod.
- * Authentication consists in sending a ucred buffer that contains the user id.
+ * It connects to the "well-known" local socket to communicate with
+ * para_audiod. Authentication is performed by sending a ucred buffer
+ * containing the user id to the local socket.
*
- * Any output received through the local socket is sent to stdout.
+ * Any data received from the socket is written to stdout.
*
* \return EXIT_SUCCESS or EXIT_FAILURE.
*
size_t n = ret = recv_bin_buffer(fd, buf, bufsize);
if (ret <= 0)
break;
- ret = write_all(STDOUT_FILENO, buf, &n);
+ ret = write_all(STDOUT_FILENO, buf, n);
} while (ret >= 0);
out:
free(buf);