From 3636ea628d051cf2ba7a9038c50528c561d0aeaa Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 19 Dec 2020 18:43:38 +0100 Subject: change GNUNET_DISK_fn_write() to always do atomic writes and to NOT overwrite existing files; also change the return value to not return the size of the written file but GNUNET_OK on success, and integrate creating the directory if needed; breaks API, hence bumping libgnunetutil version --- src/peerinfo-tool/gnunet-peerinfo.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/peerinfo-tool/gnunet-peerinfo.c') diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index 987c7c3a0..8b149c98e 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c @@ -451,13 +451,14 @@ dump_my_hello () fprintf (stderr, _ ("Failure: Received invalid %s\n"), "HELLO"); return; } - if (GNUNET_SYSERR == GNUNET_DISK_fn_write (dump_hello, - my_hello, - size, - GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE - | GNUNET_DISK_PERM_GROUP_READ - | GNUNET_DISK_PERM_OTHER_READ)) + if (GNUNET_SYSERR == + GNUNET_DISK_fn_write (dump_hello, + my_hello, + size, + GNUNET_DISK_PERM_USER_READ + | GNUNET_DISK_PERM_USER_WRITE + | GNUNET_DISK_PERM_GROUP_READ + | GNUNET_DISK_PERM_OTHER_READ)) { fprintf (stderr, _ ("Failed to write HELLO with %u bytes to file `%s'\n"), -- cgit v1.2.3