X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=audiod.c;h=e8a82b5ed254d447b8edc106e0c6f98d2a64d2f7;hb=00e95557839f3fef5fa06702f3864e8376d2a29b;hp=f8eeccee395a0a01a0fdd512e0449433c5b0da93;hpb=2cbca80137dd7b4229ba984080ac5410da546c71;p=paraslash.git diff --git a/audiod.c b/audiod.c index f8eeccee..e8a82b5e 100644 --- a/audiod.c +++ b/audiod.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2014 Andre Noll + * Copyright (C) 2005 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -310,17 +310,6 @@ empty: return para_strdup(NULL); } -static int want_colors(void) -{ - if (conf.color_arg == color_arg_no) - return 0; - if (conf.color_arg == color_arg_yes) - return 1; - if (conf.logfile_given) - return 0; - return isatty(STDERR_FILENO); -} - static void parse_config_or_die(void) { int ret; @@ -969,8 +958,7 @@ static int parse_stream_args(void) /* does not unlink socket on errors */ static int audiod_get_socket(void) { - struct sockaddr_un unix_addr; - int ret, fd; + int ret; if (conf.socket_given) socket_name = para_strdup(conf.socket_arg); @@ -983,19 +971,11 @@ static int audiod_get_socket(void) PARA_NOTICE_LOG("local socket: %s\n", socket_name); if (conf.force_given) unlink(socket_name); - ret = create_local_socket(socket_name, &unix_addr, + ret = create_local_socket(socket_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IWOTH); if (ret < 0) goto err; - fd = ret; - if (listen(fd , 5) < 0) { - ret = -ERRNO_TO_PARA_ERROR(errno); - goto err; - } - ret = mark_fd_nonblocking(fd); - if (ret < 0) - goto err; - return fd; + return ret; err: PARA_EMERG_LOG("%s\n", para_strerror(-ret)); exit(EXIT_FAILURE); @@ -1359,18 +1339,6 @@ __noreturn static void print_help_and_die(void) exit(0); } -static void init_colors_or_die(void) -{ - int i; - - if (!want_colors()) - return; - daemon_set_default_log_colors(); - daemon_set_flag(DF_COLOR_LOG); - for (i = 0; i < conf.log_color_given; i++) - daemon_set_log_color_or_die(conf.log_color_arg[i]); -} - /** * the main function of para_audiod * @@ -1405,7 +1373,8 @@ int main(int argc, char *argv[]) print_help_and_die(); daemon_drop_privileges_or_die(conf.user_arg, conf.group_arg); parse_config_or_die(); - init_colors_or_die(); + daemon_init_colors_or_die(conf.color_arg, color_arg_auto, color_arg_no, + conf.logfile_given, conf.log_color_arg, conf.log_color_given); init_random_seed_or_die(); daemon_set_flag(DF_LOG_TIME); daemon_set_flag(DF_LOG_HOSTNAME);