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/util/gnunet-scrypt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/util/gnunet-scrypt.c') diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 136c6debb..5c3dfc12e 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c @@ -65,12 +65,15 @@ static void shutdown_task (void *cls) { (void) cls; - if (sizeof(proof) != GNUNET_DISK_fn_write (pwfn, - &proof, - sizeof(proof), - GNUNET_DISK_PERM_USER_READ - | GNUNET_DISK_PERM_USER_WRITE)) - GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", pwfn); + if (GNUNET_OK != + GNUNET_DISK_fn_write (pwfn, + &proof, + sizeof(proof), + GNUNET_DISK_PERM_USER_READ + | GNUNET_DISK_PERM_USER_WRITE)) + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, + "write", + pwfn); } -- cgit v1.2.3