changeset 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 3f04914d8643
children d3e9118c2795
files mcabber/mcabber/histolog.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/histolog.c	Sat Feb 27 13:53:01 2016 +0100
+++ b/mcabber/mcabber/histolog.c	Tue Mar 15 17:24:41 2016 +0200
@@ -406,9 +406,10 @@
     RootDir = g_strdup_printf("%s%s", cfgdir, hdir);
   }
 
+  // Create full directory path in case it is absent.
   // Check directory permissions (should not be readable by group/others)
-  if (checkset_perm(RootDir, TRUE) == -1) {
-    // The directory does not actually exists
+  if (g_mkdir_with_parents(RootDir, S_IRUSR | S_IWUSR | S_IXUSR) ||
+      checkset_perm(RootDir, TRUE) == -1) {
     g_free(RootDir);
     RootDir = NULL;
     scr_LogPrint(LPRINT_LOGNORM, "ERROR: Cannot access "