make sure to create friends directory before trying to write friends file
authorChristian Grothoff <christian@grothoff.org>
Sun, 16 Feb 2014 15:22:57 +0000 (15:22 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 16 Feb 2014 15:22:57 +0000 (15:22 +0000)
src/topology/friends.c

index 6c680b7a01bec7407f63c176d00768f7e3206883..f79ee77ca5befa59b30f2fa322b0bd4e7dd371dd 100644 (file)
@@ -147,6 +147,14 @@ GNUNET_FRIENDS_write_start (const struct GNUNET_CONFIGURATION_Handle *cfg)
                               "topology", "FRIENDS");
     return NULL;
   }
+  if (GNUNET_OK !=
+      GNUNET_DISK_directory_create_for_file (fn))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                _("Directory for file `%s' does not seem to be writable.\n"),
+                fn);
+    return NULL;
+  }
   if (GNUNET_OK == GNUNET_DISK_file_test (fn))
     GNUNET_DISK_file_backup (fn);
   w = GNUNET_new (struct GNUNET_FRIENDS_Writer);