#include "audiod.cmdline.h"
#include "list.h"
#include "close_on_fork.h"
+#include "sched.h"
#include "recv.h"
#include "filter.h"
#include "grab_client.cmdline.h"
audio_formats[s->format], slot_num);
if (s->fci)
s->fci->error = 42;
+ kill_stream_writer(slot_num);
}
}
}
return;
}
if (s->write_fd > 0) {
+ PARA_INFO_LOG("err: %d\n", s->fci->error);
PARA_INFO_LOG("slot %d: closing write fd %d\n", slot_num,
s->write_fd);
close(s->write_fd);
static int handle_connect(void)
{
int i, argc, ret, clifd = -1;
- char *p, *buf = para_malloc(MAXLINE), **argv = NULL;
+ char *cmd = NULL, *p, *buf = para_calloc(MAXLINE), **argv = NULL;
struct sockaddr_un unix_addr;
ret = para_accept(audiod_socket, &unix_addr, sizeof(struct sockaddr_un));
if (ret < 0)
goto out;
ret = -E_INVALID_AUDIOD_CMD;
- p = strchr(buf, '\n');
+ cmd = para_strdup(buf);
+ p = strchr(cmd, '\n');
if (!p)
p = "";
else {
}
for (i = 0; cmds[i].name; i++) {
int j;
- if (strcmp(cmds[i].name, buf))
+ if (strcmp(cmds[i].name, cmd))
continue;
if (cmds[i].handler) {
argc = split_args(buf, &argv, "\n");
for (j = 0; p[j]; j++)
if (p[j] == '\n')
p[j] = ' ';
- PARA_INFO_LOG("cmd: %s, options: %s\n", buf, p);
+ PARA_INFO_LOG("cmd: %s, options: %s\n", cmd, p);
ret = cmds[i].line_handler(clifd, p);
goto out;
}
ret = -E_INVALID_AUDIOD_CMD; /* cmd not found */
out:
+ free(cmd);
free(buf);
free(argv);
if (clifd > 0 && ret < 0 && ret != -E_CLIENT_WRITE) {