aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNils Durner <durner@gnunet.org>2009-06-16 18:35:49 +0000
committerNils Durner <durner@gnunet.org>2009-06-16 18:35:49 +0000
commit841cf45c29f46825a8e9913c6e45dcff21318f5a (patch)
treee979726b5eb946a30cebdcabd34da81fc34d1a71 /src
parentca419dc0d9db4c5ed3784a5c5d7b46040c5203ef (diff)
downloadgnunet-841cf45c29f46825a8e9913c6e45dcff21318f5a.tar.gz
gnunet-841cf45c29f46825a8e9913c6e45dcff21318f5a.zip
match older GNUNET_DISK_file_xxx functions
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_disk_lib.h4
-rw-r--r--src/util/disk.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index 23a4789fa..080d8c09b 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -153,7 +153,7 @@ int GNUNET_DISK_file_read (const struct GNUNET_IO_Handle *h, void *result, int l
153 * @param fn file name 153 * @param fn file name
154 * @param result the buffer to write the result to 154 * @param result the buffer to write the result to
155 * @param len the maximum number of bytes to read 155 * @param len the maximum number of bytes to read
156 * @return the number of bytes read on success, GNUNET_SYSERR on failure 156 * @return GNUNET_OK on success, GNUNET_SYSERR on error
157 */ 157 */
158int GNUNET_DISK_fn_read (const char * const fn, void *result, int len); 158int GNUNET_DISK_fn_read (const char * const fn, void *result, int len);
159 159
@@ -163,7 +163,7 @@ int GNUNET_DISK_fn_read (const char * const fn, void *result, int len);
163 * @param h handle to open file 163 * @param h handle to open file
164 * @param buffer the data to write 164 * @param buffer the data to write
165 * @param n number of bytes to write 165 * @param n number of bytes to write
166 * @return number of bytes written on success, GNUNET_SYSERR on error 166 * @return GNUNET_OK on success, GNUNET_SYSERR on error
167 */ 167 */
168int GNUNET_DISK_file_write (const struct GNUNET_IO_Handle *h, const void *buffer, 168int GNUNET_DISK_file_write (const struct GNUNET_IO_Handle *h, const void *buffer,
169 unsigned int n); 169 unsigned int n);
diff --git a/src/util/disk.c b/src/util/disk.c
index 5698a8110..2c592dcfa 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -435,7 +435,7 @@ GNUNET_DISK_file_read (const struct GNUNET_IO_Handle *h, void *result, int len)
435 * @param fn file name 435 * @param fn file name
436 * @param result the buffer to write the result to 436 * @param result the buffer to write the result to
437 * @param len the maximum number of bytes to read 437 * @param len the maximum number of bytes to read
438 * @return the number of bytes read on success, GNUNET_SYSERR on failure 438 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
439 */ 439 */
440int 440int
441GNUNET_DISK_fn_read (const char * const fn, void *result, int len) 441GNUNET_DISK_fn_read (const char * const fn, void *result, int len)
@@ -446,7 +446,7 @@ GNUNET_DISK_fn_read (const char * const fn, void *result, int len)
446 fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ); 446 fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ);
447 if (!fh) 447 if (!fh)
448 return GNUNET_SYSERR; 448 return GNUNET_SYSERR;
449 ret = GNUNET_DISK_file_read (fh, result, len); 449 ret = (len == GNUNET_DISK_file_read (fh, result, len)) ? GNUNET_OK : GNUNET_SYSERR;
450 GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh)); 450 GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh));
451 451
452 return ret; 452 return ret;
@@ -505,7 +505,7 @@ GNUNET_DISK_file_write (const struct GNUNET_IO_Handle *h, const void *buffer,
505 * @param fn file name 505 * @param fn file name
506 * @param buffer the data to write 506 * @param buffer the data to write
507 * @param n number of bytes to write 507 * @param n number of bytes to write
508 * @return number of bytes written on success, GNUNET_SYSERR on error 508 * @return GNUNET_OK on success, GNUNET_SYSERR on error
509 */ 509 */
510int 510int
511GNUNET_DISK_fn_write (const char * const fn, const void *buffer, 511GNUNET_DISK_fn_write (const char * const fn, const void *buffer,
@@ -518,7 +518,7 @@ GNUNET_DISK_fn_write (const char * const fn, const void *buffer,
518 | GNUNET_DISK_OPEN_CREATE, mode); 518 | GNUNET_DISK_OPEN_CREATE, mode);
519 if (!fh) 519 if (!fh)
520 return GNUNET_SYSERR; 520 return GNUNET_SYSERR;
521 ret = GNUNET_DISK_file_write (fh, buffer, n); 521 ret = (n == GNUNET_DISK_file_write (fh, buffer, n)) ? GNUNET_OK : GNUNET_SYSERR;
522 GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh)); 522 GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh));
523 523
524 return ret; 524 return ret;