aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_fs_file_information.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/fs/test_fs_file_information.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/fs/test_fs_file_information.c')
-rw-r--r--src/fs/test_fs_file_information.c6
1 files changed, 4 insertions, 2 deletions
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,
82 buf = GNUNET_malloc (FILESIZE); 82 buf = GNUNET_malloc (FILESIZE);
83 for (i = 0; i < FILESIZE; i++) 83 for (i = 0; i < FILESIZE; i++)
84 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); 84 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
85 GNUNET_assert (FILESIZE == 85 (void) GNUNET_DISK_directory_remove (fn1);
86 GNUNET_assert (GNUNET_OK ==
86 GNUNET_DISK_fn_write (fn1, buf, FILESIZE, 87 GNUNET_DISK_fn_write (fn1, buf, FILESIZE,
87 GNUNET_DISK_PERM_USER_READ 88 GNUNET_DISK_PERM_USER_READ
88 | GNUNET_DISK_PERM_USER_WRITE)); 89 | GNUNET_DISK_PERM_USER_WRITE));
@@ -92,7 +93,8 @@ run (void *cls, char *const *args, const char *cfgfile,
92 buf = GNUNET_malloc (FILESIZE); 93 buf = GNUNET_malloc (FILESIZE);
93 for (i = 0; i < FILESIZE; i++) 94 for (i = 0; i < FILESIZE; i++)
94 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); 95 buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
95 GNUNET_assert (FILESIZE == 96 (void) GNUNET_DISK_directory_remove (fn2);
97 GNUNET_assert (GNUNET_OK ==
96 GNUNET_DISK_fn_write (fn2, buf, FILESIZE, 98 GNUNET_DISK_fn_write (fn2, buf, FILESIZE,
97 GNUNET_DISK_PERM_USER_READ 99 GNUNET_DISK_PERM_USER_READ
98 | GNUNET_DISK_PERM_USER_WRITE)); 100 | GNUNET_DISK_PERM_USER_WRITE));