| @@ -301,12 +301,10 @@ static int rtp_new_av_stream(HTTPContext *c, · 300 unmodified lines |
| 301 | 301 | HTTPContext *rtsp_c); |
| 302 | 302 | |
| 303 | 303 | static const char *my_program_name; |
| 304 | | −static const char *my_program_dir; |
| 305 | 304 | |
| 306 | 305 | static const char *config_filename = "/etc/avserver.conf"; |
| 307 | 306 | |
| 308 | 307 | static int avserver_debug; |
| 309 | | −static int avserver_daemon; |
| 310 | 308 | static int no_launch; |
| 311 | 309 | static int need_to_start_children; |
| 312 | 310 | |
| @@ -524,9 +522,6 @@ static void start_children(FFStream *feed) · 211 unmodified lines |
| 524 | 522 | } |
| 525 | 523 | } |
| 526 | 524 | |
| 527 | | − /* This is needed to make relative pathnames work */ |
| 528 | | − chdir(my_program_dir); |
| 529 | | − |
| 530 | 525 | signal(SIGPIPE, SIG_DFL); |
| 531 | 526 | |
| 532 | 527 | execvp(pathname, feed->child_argv); |
| @@ -4081,8 +4076,6 @@ static int parse_ffconfig(const char *filename) · 3548 unmodified lines |
| 4081 | 4076 | if (resolve_host(&my_http_addr.sin_addr, arg) != 0) { |
| 4082 | 4077 | ERROR("%s:%d: Invalid host/IP address: %s\n", arg); |
| 4083 | 4078 | } |
| 4084 | | − } else if (!av_strcasecmp(cmd, "NoDaemon")) { |
| 4085 | | − avserver_daemon = 0; |
| 4086 | 4079 | } else if (!av_strcasecmp(cmd, "RTSPPort")) { |
| 4087 | 4080 | get_arg(arg, sizeof(arg), &p); |
| 4088 | 4081 | val = atoi(arg); |
| @@ -4655,7 +4648,6 @@ static void handle_child_exit(int sig) · 566 unmodified lines |
| 4655 | 4648 | static void opt_debug(void) |
| 4656 | 4649 | { |
| 4657 | 4650 | avserver_debug = 1; |
| 4658 | | − avserver_daemon = 0; |
| 4659 | 4651 | logfilename[0] = '-'; |
| 4660 | 4652 | } |
| 4661 | 4653 | |
| @@ -4686,8 +4678,6 @@ int main(int argc, char **argv) · 24 unmodified lines |
| 4686 | 4678 | show_banner(); |
| 4687 | 4679 | |
| 4688 | 4680 | my_program_name = argv[0]; |
| 4689 | | − my_program_dir = getcwd(0, 0); |
| 4690 | | − avserver_daemon = 1; |
| 4691 | 4681 | |
| 4692 | 4682 | parse_options(NULL, argc, argv, options, NULL); |
| 4693 | 4683 | |
| @@ -4719,37 +4709,9 @@ int main(int argc, char **argv) · 25 unmodified lines |
| 4719 | 4709 | |
| 4720 | 4710 | compute_bandwidth(); |
| 4721 | 4711 | |
| 4722 | | − /* put the process in background and detach it from its TTY */ |
| 4723 | | − if (avserver_daemon) { |
| 4724 | | − int pid; |
| 4725 | | − |
| 4726 | | − pid = fork(); |
| 4727 | | − if (pid < 0) { |
| 4728 | | − perror("fork"); |
| 4729 | | − exit(1); |
| 4730 | | − } else if (pid > 0) { |
| 4731 | | − /* parent : exit */ |
| 4732 | | − exit(0); |
| 4733 | | − } else { |
| 4734 | | − /* child */ |
| 4735 | | − setsid(); |
| 4736 | | − close(0); |
| 4737 | | − open("/dev/null", O_RDWR); |
| 4738 | | − if (strcmp(logfilename, "-") != 0) { |
| 4739 | | − close(1); |
| 4740 | | − dup(0); |
| 4741 | | − } |
| 4742 | | − close(2); |
| 4743 | | − dup(0); |
| 4744 | | − } |
| 4745 | | − } |
| 4746 | | − |
| 4747 | 4712 | /* signal init */ |
| 4748 | 4713 | signal(SIGPIPE, SIG_IGN); |
| 4749 | 4714 | |
| 4750 | | − if (avserver_daemon) |
| 4751 | | − chdir("/"); |
| 4752 | | − |
| 4753 | 4715 | if (http_server() < 0) { |
| 4754 | 4716 | http_log("Could not start server\n"); |
| 4755 | 4717 | exit(1); |