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.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.c')
-rw-r--r-- | src/fs/test_fs_publish.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c index c42e546e3..2ffc722da 100644 --- a/src/fs/test_fs_publish.c +++ b/src/fs/test_fs_publish.c | |||
@@ -184,7 +184,8 @@ run (void *cls, | |||
184 | buf = GNUNET_malloc (FILESIZE); | 184 | buf = GNUNET_malloc (FILESIZE); |
185 | for (i = 0; i < FILESIZE; i++) | 185 | for (i = 0; i < FILESIZE; i++) |
186 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); | 186 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); |
187 | GNUNET_assert (FILESIZE == | 187 | (void) GNUNET_DISK_directory_remove (fn1); |
188 | GNUNET_assert (GNUNET_OK == | ||
188 | GNUNET_DISK_fn_write (fn1, buf, FILESIZE, | 189 | GNUNET_DISK_fn_write (fn1, buf, FILESIZE, |
189 | GNUNET_DISK_PERM_USER_READ | 190 | GNUNET_DISK_PERM_USER_READ |
190 | | GNUNET_DISK_PERM_USER_WRITE)); | 191 | | GNUNET_DISK_PERM_USER_WRITE)); |
@@ -194,7 +195,8 @@ run (void *cls, | |||
194 | buf = GNUNET_malloc (FILESIZE); | 195 | buf = GNUNET_malloc (FILESIZE); |
195 | for (i = 0; i < FILESIZE; i++) | 196 | for (i = 0; i < FILESIZE; i++) |
196 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); | 197 | buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256); |
197 | GNUNET_assert (FILESIZE == | 198 | (void) GNUNET_DISK_directory_remove (fn2); |
199 | GNUNET_assert (GNUNET_OK == | ||
198 | GNUNET_DISK_fn_write (fn2, buf, FILESIZE, | 200 | GNUNET_DISK_fn_write (fn2, buf, FILESIZE, |
199 | GNUNET_DISK_PERM_USER_READ | 201 | GNUNET_DISK_PERM_USER_READ |
200 | | GNUNET_DISK_PERM_USER_WRITE)); | 202 | | GNUNET_DISK_PERM_USER_WRITE)); |