- remove old tests
[oweals/gnunet.git] / src / topology / friends.c
index 6c680b7a01bec7407f63c176d00768f7e3206883..348123fe6fdb41df79d74fac5ffa7d83f1ccf5be 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);
@@ -186,18 +194,18 @@ GNUNET_FRIENDS_write_stop (struct GNUNET_FRIENDS_Writer *w)
  * Add a friend to the friends file.
  *
  * @param w write handle
- * @param friend friend to add
+ * @param friend_id friend to add
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 int
 GNUNET_FRIENDS_write (struct GNUNET_FRIENDS_Writer *w,
-                      const struct GNUNET_PeerIdentity *friend)
+                      const struct GNUNET_PeerIdentity *friend_id)
 {
   char *buf;
   char *ret;
   size_t slen;
 
-  ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&friend->public_key);
+  ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&friend_id->public_key);
   GNUNET_asprintf (&buf,
                    "%s\n",
                    ret);