aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo-tool/gnunet-peerinfo.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-12-19 18:43:38 +0100
committerChristian Grothoff <christian@grothoff.org>2020-12-19 18:43:38 +0100
commit3636ea628d051cf2ba7a9038c50528c561d0aeaa (patch)
tree87664b904950052e8b6997a371ed5ecb1ea4b310 /src/peerinfo-tool/gnunet-peerinfo.c
parent74d7528e6bd53cf5acc939c63a5be74a001e5ce1 (diff)
downloadgnunet-3636ea628d051cf2ba7a9038c50528c561d0aeaa.tar.gz
gnunet-3636ea628d051cf2ba7a9038c50528c561d0aeaa.zip
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
Diffstat (limited to 'src/peerinfo-tool/gnunet-peerinfo.c')
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c15
1 files changed, 8 insertions, 7 deletions
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 ()
451 fprintf (stderr, _ ("Failure: Received invalid %s\n"), "HELLO"); 451 fprintf (stderr, _ ("Failure: Received invalid %s\n"), "HELLO");
452 return; 452 return;
453 } 453 }
454 if (GNUNET_SYSERR == GNUNET_DISK_fn_write (dump_hello, 454 if (GNUNET_SYSERR ==
455 my_hello, 455 GNUNET_DISK_fn_write (dump_hello,
456 size, 456 my_hello,
457 GNUNET_DISK_PERM_USER_READ 457 size,
458 | GNUNET_DISK_PERM_USER_WRITE 458 GNUNET_DISK_PERM_USER_READ
459 | GNUNET_DISK_PERM_GROUP_READ 459 | GNUNET_DISK_PERM_USER_WRITE
460 | GNUNET_DISK_PERM_OTHER_READ)) 460 | GNUNET_DISK_PERM_GROUP_READ
461 | GNUNET_DISK_PERM_OTHER_READ))
461 { 462 {
462 fprintf (stderr, 463 fprintf (stderr,
463 _ ("Failed to write HELLO with %u bytes to file `%s'\n"), 464 _ ("Failed to write HELLO with %u bytes to file `%s'\n"),