Commit 2cf9930e authored by Thomas B. Rücker's avatar Thomas B. Rücker 😊

Reverting r18945 for now as using -b breaks things.

Reopening #1886

svn path=/icecast/trunk/icecast/; revision=19100
parent b6b01430
......@@ -3,11 +3,10 @@
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2000-2013, Jack Moffitt <jack@xiph.org,
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
* Michael Smith <msmith@xiph.org>,
* oddsock <oddsock@xiph.org>,
* Karl Heyes <karl@xiph.org>,
* Thomas B. Ruecker <thomas.ruecker@tieto.com>
* Karl Heyes <karl@xiph.org>
* and others (see AUTHORS for details).
* Copyright 2011-2012, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
......@@ -152,12 +151,31 @@ void shutdown_subsystems(void)
static int _parse_config_opts(int argc, char **argv, char *filename, int size)
{
int i;
int i = 1;
int config_ok = 0;
background = 0;
if (argc < 2) return -1;
for (i = 1; i < argc; i++) {
while (i < argc) {
if (strcmp(argv[i], "-b") == 0) {
#ifndef WIN32
pid_t pid;
fprintf(stdout, "Starting icecast2\nDetaching from the console\n");
pid = fork();
if (pid > 0) {
/* exit the parent */
exit(0);
}
else if(pid < 0) {
fprintf(stderr, "FATAL: Unable to fork child!");
exit(1);
}
background = 1;
#endif
}
if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) {
fprintf(stdout, "%s\n", ICECAST_VERSION_STRING);
exit(0);
......@@ -172,6 +190,7 @@ static int _parse_config_opts(int argc, char **argv, char *filename, int size)
return -1;
}
}
i++;
}
if(config_ok)
......@@ -180,34 +199,6 @@ static int _parse_config_opts(int argc, char **argv, char *filename, int size)
return -1;
}
static int _parse_config_opts_remaining(int argc, char **argv, char *filename, int size)
{
int i;
background = 0;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-b") == 0) {
#ifndef WIN32
pid_t pid;
fprintf(stdout, "Starting icecast2\nDetaching from the console\n");
pid = fork();
if (pid > 0) {
/* exit the parent */
exit(0);
}
else if(pid < 0) {
fprintf(stderr, "FATAL: Unable to fork child!");
exit(1);
}
background = 1;
#endif
}
}
return 0;
}
static int _start_logging(void)
{
char fn_error[FILENAME_MAX];
......@@ -510,9 +501,6 @@ int main(int argc, char **argv)
return 1;
}
/* Delayed command line argument parsing, e.g. background */
_parse_config_opts_remaining(argc, argv, filename, 512);
INFO1 ("%s server started", ICECAST_VERSION_STRING);
/* REM 3D Graphics */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment