From 7161cff0b3d0d8ec995d3297747557a8d1b08eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Mon, 20 Jul 2009 06:24:57 +0000 Subject: [PATCH] * Use absolute paths when serving static content (the web app itself) This was only a problem when fork()ing a development build --- debian/changelog | 3 +++ src/webui/webui.c | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 33ad3fff..c9e25eb5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,9 @@ hts-tvheadend (2.4) hts; urgency=low * The embedded HTTP server now logs failed requests + * Use absolute paths when serving static content (the web app itself) + This was only a problem when fork()ing a development build + hts-tvheadend (2.3) hts; urgency=low * A simple web interface has been added. To access it, visit diff --git a/src/webui/webui.c b/src/webui/webui.c index 8c55180b..f7188866 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -102,10 +102,14 @@ page_static_file(http_connection_t *hc, const char *remain, void *opaque) snprintf(path, sizeof(path), "%s/%s", base, remain); - if((fd = open(path, O_RDONLY)) < 0) + if((fd = open(path, O_RDONLY)) < 0) { + tvhlog(LOG_ERR, "webui", + "Unable to open file %s -- %s", path, strerror(errno)); return 404; - + } if(fstat(fd, &st) < 0) { + tvhlog(LOG_ERR, "webui", + "Unable to stat file %s -- %s", path, strerror(errno)); close(fd); return 404; } @@ -232,7 +236,7 @@ webui_static_content(const char *content_path, const char *http_path, if(!stat(path, &st) && S_ISDIR(st.st_mode)) { - http_path_add(http_path, strdup(source), + http_path_add(http_path, strdup(path), page_static_file, ACCESS_WEB_INTERFACE); return; }