Use full path when trying to load config from build structure

This commit is contained in:
Andreas Öman 2007-08-19 08:43:57 +00:00
parent bfb16c0ee4
commit d0eb22fa7b
2 changed files with 20 additions and 5 deletions

View file

@ -12,9 +12,9 @@ SRCS += iptv_input.c iptv_output.c
SRCS += htsclient.c
PROG = tvhead
PROG = tvheadend
CFLAGS += -g -Wall -Werror -O2
CFLAGS += -I$(INCLUDES_INSTALL_BASE)
CFLAGS += -I$(INCLUDES_INSTALL_BASE) $(HTS_CFLAGS)
CFLAGS += -Wno-deprecated-declarations
CFLAGS += -D_LARGEFILE64_SOURCE
CFLAGS += -DENABLE_INPUT_IPTV -DENABLE_INPUT_DVB

21
main.c
View file

@ -46,6 +46,7 @@
#include "pvr.h"
#include "dispatch.h"
#include "iptv_output.h"
#include "config.h"
int running;
int xmltvreload;
@ -100,8 +101,7 @@ main(int argc, char **argv)
const char *groupnam = NULL;
char *cfgfile;
int logfacility = LOG_DAEMON;
int r;
signal(SIGPIPE, handle_sigpipe);
@ -124,7 +124,22 @@ main(int argc, char **argv)
}
}
config_read_file(cfgfile);
if((r = config_read_file(cfgfile)) < 0) {
fprintf(stderr,
"configfile \"%s\" not found, trying from build structure\n",
cfgfile);
cfgfile = HTS_BUILD_ROOT "/etc/tvheadend.cfg";
r = config_read_file(cfgfile);
}
if(r < 0)
fprintf(stderr,
"configfile \"%s\" not found, running with defaults\n",
cfgfile);
else
fprintf(stderr, "Config from \"%s\" loaded\n", cfgfile);
if(forkaway) {
if(daemon(0, 0)) {