aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-25 19:28:48 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-25 19:28:48 +0000
commit99bb34bf91253eb90fd1bc900af88580c6461e53 (patch)
tree12802c0669e910d45fbb811f71aa642bb4bb6332 /src/util
parentc3bf5dd8d37b9e65a973c9fb83734f8ff7401266 (diff)
downloadgnunet-99bb34bf91253eb90fd1bc900af88580c6461e53.tar.gz
gnunet-99bb34bf91253eb90fd1bc900af88580c6461e53.zip
more consistent disk API
Diffstat (limited to 'src/util')
-rw-r--r--src/util/disk.c7
-rw-r--r--src/util/pseudonym.c5
-rw-r--r--src/util/test_disk.c6
3 files changed, 10 insertions, 8 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index 40d637ee3..b0c648b25 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -653,7 +653,7 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, const void *buff
653 * @param buffer the data to write 653 * @param buffer the data to write
654 * @param n number of bytes to write 654 * @param n number of bytes to write
655 * @param mode file permissions 655 * @param mode file permissions
656 * @return GNUNET_OK on success, GNUNET_SYSERR on error 656 * @return number of bytes written on success, GNUNET_SYSERR on error
657 */ 657 */
658ssize_t 658ssize_t
659GNUNET_DISK_fn_write (const char * fn, const void *buffer, 659GNUNET_DISK_fn_write (const char * fn, const void *buffer,
@@ -661,7 +661,7 @@ GNUNET_DISK_fn_write (const char * fn, const void *buffer,
661 enum GNUNET_DISK_AccessPermissions mode) 661 enum GNUNET_DISK_AccessPermissions mode)
662{ 662{
663 struct GNUNET_DISK_FileHandle *fh; 663 struct GNUNET_DISK_FileHandle *fh;
664 int ret; 664 ssize_t ret;
665 665
666 fh = GNUNET_DISK_file_open (fn, 666 fh = GNUNET_DISK_file_open (fn,
667 GNUNET_DISK_OPEN_WRITE 667 GNUNET_DISK_OPEN_WRITE
@@ -669,9 +669,8 @@ GNUNET_DISK_fn_write (const char * fn, const void *buffer,
669 | GNUNET_DISK_OPEN_CREATE, mode); 669 | GNUNET_DISK_OPEN_CREATE, mode);
670 if (!fh) 670 if (!fh)
671 return GNUNET_SYSERR; 671 return GNUNET_SYSERR;
672 ret = (n == GNUNET_DISK_file_write (fh, buffer, n)) ? GNUNET_OK : GNUNET_SYSERR; 672 ret = GNUNET_DISK_file_write (fh, buffer, n);
673 GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(fh)); 673 GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(fh));
674
675 return ret; 674 return ret;
676} 675}
677 676
diff --git a/src/util/pseudonym.c b/src/util/pseudonym.c
index 04a6a1f78..40165800b 100644
--- a/src/util/pseudonym.c
+++ b/src/util/pseudonym.c
@@ -209,8 +209,9 @@ write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
209 off + 1], 209 off + 1],
210 size, 210 size,
211 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL)); 211 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL));
212 GNUNET_DISK_fn_write (fn, buf, tag, GNUNET_DISK_PERM_USER_READ 212 GNUNET_break
213 | GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_PERM_GROUP_READ); 213 (tag != GNUNET_DISK_fn_write (fn, buf, tag, GNUNET_DISK_PERM_USER_READ
214 | GNUNET_DISK_PERM_USER_WRITE | GNUNET_DISK_PERM_GROUP_READ));
214 GNUNET_free (fn); 215 GNUNET_free (fn);
215 GNUNET_free (buf); 216 GNUNET_free (buf);
216 /* create entry for pseudonym name in names */ 217 /* create entry for pseudonym name in names */
diff --git a/src/util/test_disk.c b/src/util/test_disk.c
index 705a24abf..8b485edc5 100644
--- a/src/util/test_disk.c
+++ b/src/util/test_disk.c
@@ -36,8 +36,10 @@ testReadWrite ()
36 char tmp[100 + 1]; 36 char tmp[100 + 1];
37 int ret; 37 int ret;
38 38
39 if (GNUNET_OK != GNUNET_DISK_fn_write (".testfile", TESTSTRING, strlen ( 39 if (strlen(TESTSTRING) !=
40 TESTSTRING), GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)) 40 GNUNET_DISK_fn_write (".testfile", TESTSTRING,
41 strlen (TESTSTRING),
42 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE))
41 return 1; 43 return 1;
42 if (GNUNET_OK != GNUNET_DISK_file_test (".testfile")) 44 if (GNUNET_OK != GNUNET_DISK_file_test (".testfile"))
43 return 1; 45 return 1;