* Use absolute paths when serving static content (the web app itself)

This was only a problem when fork()ing a development build
This commit is contained in:
Andreas Öman 2009-07-20 06:24:57 +00:00
parent 36359f8ae2
commit 7161cff0b3
2 changed files with 10 additions and 3 deletions

3
debian/changelog vendored
View file

@ -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

View file

@ -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;
}