From d0eb22fa7baabd6416ed41554b79554449be8242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Sun, 19 Aug 2007 08:43:57 +0000 Subject: [PATCH] Use full path when trying to load config from build structure --- Makefile | 4 ++-- main.c | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9746c5f2..99c4dcd6 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/main.c b/main.c index 79e2f266..4709cabc 100644 --- a/main.c +++ b/main.c @@ -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)) {