uint32_t accessmask)
{
http_path_t *hp = malloc(sizeof(http_path_t));
+ char *tmp;
if (tvheadend_webroot) {
- char *tmp; const char *pre = "";
size_t len = strlen(tvheadend_webroot) + strlen(path) + 1;
- if (*tvheadend_webroot != '/') {
- len++;
- pre = "/";
- }
hp->hp_path = tmp = malloc(len);
- sprintf(tmp, "%s%s%s", pre, tvheadend_webroot, path);
+ sprintf(tmp, "%s/%s", tvheadend_webroot, path);
} else
hp->hp_path = strdup(path);
hp->hp_len = strlen(hp->hp_path);
int webui_port;
int htsp_port;
int htsp_port_extra;
-char *tvheadend_cwd;
+const char *tvheadend_cwd;
const char *tvheadend_webroot;
const char *tvheadend_capabilities[] = {
const char *pidpath = "/var/run/tvheadend.pid";
struct group *grp;
struct passwd *pw;
+ char *webroot;
const char *usernam = NULL;
const char *groupnam = NULL;
int logfacility = LOG_DAEMON;
join_transport = optarg;
break;
case 'W':
- tvheadend_webroot = optarg;
+ webroot = malloc(strlen(optarg) + (*optarg == '/' ? 0 : 1));
+ if (*optarg != '/') {
+ *webroot = '/';
+ strcpy(webroot+1, optarg);
+ } else {
+ strcpy(webroot, optarg);
+ }
+ if (webroot[strlen(webroot)-1] == '/')
+ webroot[strlen(webroot)-1] = '\0';
+ tvheadend_webroot = webroot;
break;
default:
usage(argv[0]);
#include "redblack.h"
extern const char *tvheadend_version;
-extern char *tvheadend_cwd;
+extern const char *tvheadend_cwd;
extern const char *tvheadend_capabilities[];
extern const char *tvheadend_webroot;