X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=8b9f181b80edfb74b31ec08aed23d61d74c8c19f;hp=bcead91ff11ab61582f8fd1b98197cc96433d608;hb=bc3ab35d42d4bb321f984806c43b7b991e973716;hpb=7d1805d1559e08e0af701155574aef220925d411 diff --git a/audiod.c b/audiod.c index bcead91f..8b9f181b 100644 --- a/audiod.c +++ b/audiod.c @@ -71,8 +71,7 @@ struct slot_info slot[MAX_STREAM_SLOTS]; int audiod_status = AUDIOD_ON; struct gengetopt_args_info conf; -static char *af_status, /* the audio format announced in server status */ - *socket_name; +static char *socket_name; static FILE *logfile; static struct audio_format_info afi[NUM_AUDIO_FORMATS]; @@ -289,8 +288,7 @@ void __noreturn clean_exit(int status, const char *msg) PARA_EMERG_LOG("%s\n", msg); if (socket_name) unlink(socket_name); - if (stat_task->fd >= 0) - close_stat_pipe(); + close_stat_pipe(); exit(status); } @@ -451,9 +449,9 @@ static int open_current_receiver(struct sched *s) int i; struct timeval diff; - if (!af_status) + if (!stat_task->af_status) return 0; - i = get_audio_format_num(af_status); + i = get_audio_format_num(stat_task->af_status); if (i < 0) return 0; if (decoder_running(i)) @@ -529,8 +527,8 @@ static void check_stat_line(char *line) stat_task->playing = strstr(line, "playing")? 1 : 0; break; case SI_FORMAT: - free(af_status); - af_status = para_strdup(line + ilen + 1); + free(stat_task->af_status); + stat_task->af_status = para_strdup(line + ilen + 1); break; case SI_OFFSET: stat_task->offset_seconds = atoi(line + ilen + 1); @@ -883,6 +881,7 @@ static int audiod_get_socket(void) exit(EXIT_FAILURE); /* do not unlink socket */ } add_close_on_fork_list(fd); + mark_fd_nonblock(fd); return fd; } @@ -895,6 +894,7 @@ static int open_stat_pipe(void) ret = fd[1]; PARA_NOTICE_LOG("stat pipe opened, fd %d\n", ret); add_close_on_fork_list(ret); + mark_fd_nonblock(ret); } else clean_exit(EXIT_FAILURE, "failed to open status pipe"); return ret; @@ -1053,8 +1053,6 @@ int main(int argc, char *argv[]) struct command_task command_task_struct, *cmd_task = &command_task_struct; struct task audiod_task_struct, *audiod_task = &audiod_task_struct; - init_sched(); - valid_fd_012(); cmdline_parser(argc, argv, &conf); para_drop_privileges(conf.user_arg, conf.group_arg);