If no setting storage has been specified in the config, warn user

This commit is contained in:
Andreas Öman 2008-02-14 06:52:02 +00:00
parent a652f09bcc
commit ec9406de71
3 changed files with 22 additions and 1 deletions

View file

@ -329,6 +329,17 @@ top_menu(http_connection_t *hc, tcp_queue_t *tq)
box_bottom(tq);
tcp_qprintf(tq, "</div><br>\r\n");
if(sys_warning != NULL) {
box_top(tq, "box");
tcp_qprintf(tq,
"<div class=\"content\">"
"<span style=\"color:#aa3333;font-weight:bold\">"
"Warning: %s</span></div>",
sys_warning);
box_bottom(tq);
tcp_qprintf(tq, "</div><br>\r\n");
}
}

11
main.c
View file

@ -61,6 +61,7 @@ int running;
int xmltvreload;
int startupcounter;
const char *settings_dir;
const char *sys_warning;
static pthread_mutex_t tag_mutex = PTHREAD_MUTEX_INITIALIZER;
static uint32_t tag_tally;
@ -169,7 +170,15 @@ main(int argc, char **argv)
openlog("tvheadend", LOG_PID, logfacility);
settings_dir = config_get_str("settings-dir", "/tmp/tvheadend");
settings_dir = config_get_str("settings-dir", NULL);
if(settings_dir == NULL) {
settings_dir = "/tmp/tvheadend";
sys_warning =
"All channelsetup/recording info is stored in "
"'/tmp/tvheadend' and may not survive a system restart. "
"Please see the configuration manual for how to setup this correctly.";
}
mkdir(settings_dir, 0777);
snprintf(buf, sizeof(buf), "%s/channels", settings_dir);

View file

@ -836,5 +836,6 @@ uint32_t tag_get(void);
extern const char *settings_dir;
FILE *settings_open_for_write(const char *name);
FILE *settings_open_for_read(const char *name);
extern const char *sys_warning;
#endif /* TV_HEAD_H */