On 2012-10-25 17:14:19 +0200, Janne Grunau wrote:
> From: Mans Rullgard <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Janne Grunau <[email protected]>
> ---
> Changelog | 2 +-
> avserver.c | 38 --------------------------------------
> doc/avserver.conf | 3 ---
> doc/avserver.texi | 8 +-------
> 4 files changed, 2 insertions(+), 49 deletions(-)
>
> diff --git a/Changelog b/Changelog
> index c3d55c1..7f137af 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -4,7 +4,7 @@ releases are sorted from youngest to oldest.
> version <next>:
> - metadata (INFO tag) support in WAV muxer
> - support for building DLLs using MSVC
> -
> +- remove avserver daemon mode
missing newline fixed locally
> version 9_beta1:
>
> diff --git a/avserver.c b/avserver.c
> index 994edcd0..8bc6b3c 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);
> @@ -4078,8 +4073,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);
> @@ -4652,7 +4645,6 @@ static void handle_child_exit(int sig)
> static void opt_debug(void)
> {
> avserver_debug = 1;
> - avserver_daemon = 0;
> logfilename[0] = '-';
> }
>
> @@ -4683,8 +4675,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);
>
> @@ -4716,37 +4706,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);
looks ok, documentation changes are mine
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel