Correct mistake which stops unix sockets being created where directories do not yet exist.

This commit is contained in:
Adam Sutton 2012-08-17 13:46:02 +01:00
parent afbaf935d6
commit 79bbe2e44d
3 changed files with 8 additions and 3 deletions

View file

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

View file

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

View file

@ -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__ */