diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-12-19 18:43:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-12-19 18:43:38 +0100 |
commit | 3636ea628d051cf2ba7a9038c50528c561d0aeaa (patch) | |
tree | 87664b904950052e8b6997a371ed5ecb1ea4b310 /src/fs/test_fs_publish_persistence.c | |
parent | 74d7528e6bd53cf5acc939c63a5be74a001e5ce1 (diff) | |
download | gnunet-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_publish_persistence.c')
-rw-r--r-- | src/fs/test_fs_publish_persistence.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index 4ec39d06e..da0209793 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c | |||
@@ -258,7 +258,8 @@ run (void *cls, | |||
258 | buf = GNUNET_malloc (FILESIZE); | 258 | buf = GNUNET_malloc (FILESIZE); |
259 | for (i = 0; i < FILESIZE; i++) | 259 | for (i = 0; i < FILESIZE; i++) |
260 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); | 260 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); |
261 | GNUNET_assert (FILESIZE == | 261 | (void) GNUNET_DISK_directory_remove (fn1); |
262 | GNUNET_assert (GNUNET_OK == | ||
262 | GNUNET_DISK_fn_write (fn1, buf, FILESIZE, | 263 | GNUNET_DISK_fn_write (fn1, buf, FILESIZE, |
263 | GNUNET_DISK_PERM_USER_READ | 264 | GNUNET_DISK_PERM_USER_READ |
264 | | GNUNET_DISK_PERM_USER_WRITE)); | 265 | | GNUNET_DISK_PERM_USER_WRITE)); |
@@ -268,7 +269,8 @@ run (void *cls, | |||
268 | buf = GNUNET_malloc (FILESIZE); | 269 | buf = GNUNET_malloc (FILESIZE); |
269 | for (i = 0; i < FILESIZE; i++) | 270 | for (i = 0; i < FILESIZE; i++) |
270 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); | 271 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); |
271 | GNUNET_assert (FILESIZE == | 272 | (void) GNUNET_DISK_directory_remove (fn2); |
273 | GNUNET_assert (GNUNET_OK == | ||
272 | GNUNET_DISK_fn_write (fn2, buf, FILESIZE, | 274 | GNUNET_DISK_fn_write (fn2, buf, FILESIZE, |
273 | GNUNET_DISK_PERM_USER_READ | 275 | GNUNET_DISK_PERM_USER_READ |
274 | | GNUNET_DISK_PERM_USER_WRITE)); | 276 | | GNUNET_DISK_PERM_USER_WRITE)); |