diff options
author | Mans Rullgard <mans@mansr.com> | 2012-04-25 12:08:54 +0000 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-11-15 17:36:14 +0100 |
commit | ada51a334aeb1e378fe852c8b5eede9cbbd05f69 (patch) | |
tree | d541ae47107863e9987bb52507dc8ed6381d6db0 /avserver.c | |
parent | 9eded0fe412e610ee8944681d5c554b723463e96 (diff) | |
download | ffmpeg-ada51a334aeb1e378fe852c8b5eede9cbbd05f69.tar.gz |
avserver: remove daemon mode
This code spews a multitude of warnings with glibc (unchecked
return values), some of them possibly warranted. Furthermore,
the deamonisation is not suitable for use with typical startup
scripts as it does not provide the PID of the daemon in any way.
Users wishing to run avserver as a daemon can still do so using
start-stop-daemon or equivalent tools.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
Diffstat (limited to 'avserver.c')
-rw-r--r-- | avserver.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/avserver.c b/avserver.c index f9d85d8d3e..649cbedbab 100644 --- a/avserver.c +++ b/avserver.c @@ -301,12 +301,10 @@ static int rtp_new_av_stream(HTTPContext *c, HTTPContext *rtsp_c); static const char *my_program_name; -static const char *my_program_dir; static const char *config_filename = "/etc/avserver.conf"; static int avserver_debug; -static int avserver_daemon; static int no_launch; static int need_to_start_children; @@ -524,9 +522,6 @@ static void start_children(FFStream *feed) } } - /* This is needed to make relative pathnames work */ - chdir(my_program_dir); - signal(SIGPIPE, SIG_DFL); execvp(pathname, feed->child_argv); @@ -4081,8 +4076,6 @@ static int parse_ffconfig(const char *filename) if (resolve_host(&my_http_addr.sin_addr, arg) != 0) { ERROR("%s:%d: Invalid host/IP address: %s\n", arg); } - } else if (!av_strcasecmp(cmd, "NoDaemon")) { - avserver_daemon = 0; } else if (!av_strcasecmp(cmd, "RTSPPort")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); @@ -4655,7 +4648,6 @@ static void handle_child_exit(int sig) static void opt_debug(void) { avserver_debug = 1; - avserver_daemon = 0; logfilename[0] = '-'; } @@ -4686,8 +4678,6 @@ int main(int argc, char **argv) show_banner(); my_program_name = argv[0]; - my_program_dir = getcwd(0, 0); - avserver_daemon = 1; parse_options(NULL, argc, argv, options, NULL); @@ -4719,37 +4709,9 @@ int main(int argc, char **argv) compute_bandwidth(); - /* put the process in background and detach it from its TTY */ - if (avserver_daemon) { - int pid; - - pid = fork(); - if (pid < 0) { - perror("fork"); - exit(1); - } else if (pid > 0) { - /* parent : exit */ - exit(0); - } else { - /* child */ - setsid(); - close(0); - open("/dev/null", O_RDWR); - if (strcmp(logfilename, "-") != 0) { - close(1); - dup(0); - } - close(2); - dup(0); - } - } - /* signal init */ signal(SIGPIPE, SIG_IGN); - if (avserver_daemon) - chdir("/"); - if (http_server() < 0) { http_log("Could not start server\n"); exit(1); |