From 841cf45c29f46825a8e9913c6e45dcff21318f5a Mon Sep 17 00:00:00 2001 From: Nils Durner Date: Tue, 16 Jun 2009 18:35:49 +0000 Subject: [PATCH] match older GNUNET_DISK_file_xxx functions --- src/include/gnunet_disk_lib.h | 4 ++-- src/util/disk.c | 8 ++++---- 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 * @param fn file name * @param result the buffer to write the result to * @param len the maximum number of bytes to read - * @return the number of bytes read on success, GNUNET_SYSERR on failure + * @return GNUNET_OK on success, GNUNET_SYSERR on error */ int GNUNET_DISK_fn_read (const char * const fn, void *result, int len); @@ -163,7 +163,7 @@ int GNUNET_DISK_fn_read (const char * const fn, void *result, int len); * @param h handle to open file * @param buffer the data to write * @param n number of bytes to write - * @return number of bytes written on success, GNUNET_SYSERR on error + * @return GNUNET_OK on success, GNUNET_SYSERR on error */ int GNUNET_DISK_file_write (const struct GNUNET_IO_Handle *h, const void *buffer, 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) * @param fn file name * @param result the buffer to write the result to * @param len the maximum number of bytes to read - * @return the number of bytes read on success, GNUNET_SYSERR on failure + * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int GNUNET_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) fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ); if (!fh) return GNUNET_SYSERR; - ret = GNUNET_DISK_file_read (fh, result, len); + ret = (len == GNUNET_DISK_file_read (fh, result, len)) ? GNUNET_OK : GNUNET_SYSERR; GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh)); return ret; @@ -505,7 +505,7 @@ GNUNET_DISK_file_write (const struct GNUNET_IO_Handle *h, const void *buffer, * @param fn file name * @param buffer the data to write * @param n number of bytes to write - * @return number of bytes written on success, GNUNET_SYSERR on error + * @return GNUNET_OK on success, GNUNET_SYSERR on error */ int GNUNET_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, | GNUNET_DISK_OPEN_CREATE, mode); if (!fh) return GNUNET_SYSERR; - ret = GNUNET_DISK_file_write (fh, buffer, n); + ret = (n == GNUNET_DISK_file_write (fh, buffer, n)) ? GNUNET_OK : GNUNET_SYSERR; GNUNET_assert(GNUNET_OK == GNUNET_DISK_file_close(&fh)); return ret; -- 2.25.1