Changeset 7425
- Timestamp:
- 09/12/12 21:31:29 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-webif-lib.c
r7346 r7425 190 190 /* Creates a path to a template file. You need to set the resultsize to the correct size of result. */ 191 191 char *tpl_getFilePathInSubdir(const char *path, const char* subdir, const char *name, const char* ext, char *result, uint32_t resultsize){ 192 if(strlen(path) + strlen(name) + strlen(subdir) + strlen(ext) < resultsize){ 193 snprintf(result, resultsize, "%s%s%s%s", path, subdir, name, ext); 192 int path_len = strlen(path); 193 const char *path_fixup = ""; 194 if (path_len && path[path_len - 1] != '/') 195 path_fixup = "/"; 196 if (path_len + strlen(path_fixup) + strlen(name) + strlen(subdir) + strlen(ext) < resultsize) { 197 snprintf(result, resultsize, "%s%s%s%s%s", path, path_fixup, subdir, name, ext); 194 198 } else result[0] = '\0'; 195 199 -
trunk/oscam-config.c
r7421 r7425 340 340 } 341 341 342 void webif_fixups_fn(void *UNUSED(var)) {343 if (cfg.http_tpl) {344 int len = strlen(cfg.http_tpl);345 if (cfg.http_tpl[len - 1] != '/') {346 cfg.http_tpl = realloc(cfg.http_tpl, len + 2);347 cfg.http_tpl[len + 0] = '/';348 cfg.http_tpl[len + 1] = '\0';349 }350 }351 }352 353 342 static bool webif_should_save_fn(void *UNUSED(var)) { return cfg.http_port; } 354 343 355 344 static const struct config_list webif_opts[] = { 356 DEF_OPT_FIXUP_FUNC(webif_fixups_fn),357 345 DEF_OPT_SAVE_FUNC(webif_should_save_fn), 358 346 DEF_OPT_FUNC("httpport" , OFS(http_port), http_port_fn ),
Note:
See TracChangeset
for help on using the changeset viewer.