From: Adam Sutton Date: Fri, 17 Aug 2012 12:46:02 +0000 (+0100) Subject: Correct mistake which stops unix sockets being created where directories do not yet... X-Git-Tag: 3.3~162 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79bbe2e44d2069df59fa345e7ac487b499f3e6ed;p=thirdparty%2Ftvheadend.git Correct mistake which stops unix sockets being created where directories do not yet exist. --- diff --git a/src/epggrab/module.c b/src/epggrab/module.c index 4f32ef72d..d66d26437 100644 --- a/src/epggrab/module.c +++ b/src/epggrab/module.c @@ -361,6 +361,7 @@ int epggrab_module_enable_socket ( void *m, uint8_t e ) /* Enable */ } else { unlink(mod->path); // just in case! + hts_settings_makedirs(mod->path); mod->sock = socket(AF_UNIX, SOCK_STREAM, 0); assert(mod->sock); diff --git a/src/settings.c b/src/settings.c index 8f2088dc6..eb33d5f29 100644 --- a/src/settings.c +++ b/src/settings.c @@ -80,12 +80,14 @@ hts_settings_init(const char *confpath) /** * */ -static int -hts_settings_makedirs ( char *path ) +int +hts_settings_makedirs ( const char *inpath ) { size_t x; struct stat st; - size_t l = strlen(path); + char path[512]; + size_t l = strlen(inpath); + strcpy(path, inpath); for(x = 0; x < l; x++) { if(path[x] == '/' && x != 0) { path[x] = 0; diff --git a/src/settings.h b/src/settings.h index 1713d9d26..7f0bb8d02 100644 --- a/src/settings.h +++ b/src/settings.h @@ -34,4 +34,6 @@ const char *hts_settings_get_root(void); int hts_settings_open_file(int for_write, const char *pathfmt, ...); +int hts_settings_makedirs ( const char *path ); + #endif /* HTSSETTINGS_H__ */