comparison mcabber/mcabber/histolog.c @ 2258:1cc88b0efdb9

Create history log dir if it doesn't exist Full path is created recursively as needed.
author Andrey Utkin <andrey_utkin@fastmail.com>
date Tue, 15 Mar 2016 17:24:41 +0200
parents 5a107c907e71
children f5402d705f67
comparison
equal deleted inserted replaced
2257:3f04914d8643 2258:1cc88b0efdb9
404 return; 404 return;
405 } 405 }
406 RootDir = g_strdup_printf("%s%s", cfgdir, hdir); 406 RootDir = g_strdup_printf("%s%s", cfgdir, hdir);
407 } 407 }
408 408
409 // Create full directory path in case it is absent.
409 // Check directory permissions (should not be readable by group/others) 410 // Check directory permissions (should not be readable by group/others)
410 if (checkset_perm(RootDir, TRUE) == -1) { 411 if (g_mkdir_with_parents(RootDir, S_IRUSR | S_IWUSR | S_IXUSR) ||
411 // The directory does not actually exists 412 checkset_perm(RootDir, TRUE) == -1) {
412 g_free(RootDir); 413 g_free(RootDir);
413 RootDir = NULL; 414 RootDir = NULL;
414 scr_LogPrint(LPRINT_LOGNORM, "ERROR: Cannot access " 415 scr_LogPrint(LPRINT_LOGNORM, "ERROR: Cannot access "
415 "history log directory; logging DISABLED"); 416 "history log directory; logging DISABLED");
416 UseFileLogging = FileLoadLogs = FALSE; 417 UseFileLogging = FileLoadLogs = FALSE;