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/fs/test_fs_file_information.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/fs/test_fs_file_information.c') diff --git a/src/fs/test_fs_file_information.c b/src/fs/test_fs_file_information.c index 9305471d6..9d0978e06 100644 --- a/src/fs/test_fs_file_information.c +++ b/src/fs/test_fs_file_information.c @@ -82,7 +82,8 @@ run (void *cls, char *const *args, const char *cfgfile, buf = GNUNET_malloc (FILESIZE); for (i = 0; i < FILESIZE; i++) buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); - GNUNET_assert (FILESIZE == + (void) GNUNET_DISK_directory_remove (fn1); + GNUNET_assert (GNUNET_OK == GNUNET_DISK_fn_write (fn1, buf, FILESIZE, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)); @@ -92,7 +93,8 @@ run (void *cls, char *const *args, const char *cfgfile, buf = GNUNET_malloc (FILESIZE); for (i = 0; i < FILESIZE; i++) buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); - GNUNET_assert (FILESIZE == + (void) GNUNET_DISK_directory_remove (fn2); + GNUNET_assert (GNUNET_OK == GNUNET_DISK_fn_write (fn2, buf, FILESIZE, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)); -- cgit v1.2.3