[xiph-cvs] r6152 - icecast/trunk/icecast/src
msmith at xiph.org
msmith at xiph.org
Sun Mar 21 18:16:58 PST 2004
Author: msmith
Date: 2004-03-21 21:16:57 -0500 (Sun, 21 Mar 2004)
New Revision: 6152
Modified:
icecast/trunk/icecast/src/main.c
Log:
Make icecast keep parsing command line options after -c.
Error message if fork fails.
All untested; the conversion broke the build.
<p><p>Modified: icecast/trunk/icecast/src/main.c
===================================================================
--- icecast/trunk/icecast/src/main.c 2004-03-22 01:18:14 UTC (rev 6151)
+++ icecast/trunk/icecast/src/main.c 2004-03-22 02:16:57 UTC (rev 6152)
@@ -133,11 +133,13 @@
xmlCleanupParser();
}
-static int _parse_config_file(int argc, char **argv, char *filename, int size)
+static int _parse_config_opts(int argc, char **argv, char *filename, int size)
{
int i = 1;
- int processID = 0;
+ int processID = 0;
+ int config_ok = 0;
+
if (argc < 2) return -1;
while (i < argc) {
@@ -146,8 +148,12 @@
fprintf(stdout, "Starting icecast2\nDetaching from the console\n");
if ((processID = (int)fork()) > 0) {
/* exit the parent */
- _exit(0);
+ exit(0);
}
+ else {
+ fprintf(stderr, "FATAL: Unable to fork child!");
+ exit(1);
+ }
#endif
}
if (strcmp(argv[i], "-v") == 0) {
@@ -159,7 +165,7 @@
if (i + 1 < argc) {
strncpy(filename, argv[i + 1], size-1);
filename[size-1] = 0;
- return 1;
+ config_ok = 1;
} else {
return -1;
}
@@ -167,7 +173,10 @@
i++;
}
- return -1;
+ if(config_ok)
+ return 1;
+ else
+ return -1;
}
static int _start_logging(void)
@@ -369,7 +378,7 @@
/* parse the '-c icecast.xml' option
** only, so that we can read a configfile
*/
- res = _parse_config_file(argc, argv, filename, 512);
+ res = _parse_config_opts(argc, argv, filename, 512);
if (res == 1) {
/* startup all the modules */
_initialize_subsystems();
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list