aboutsummaryrefslogtreecommitdiff
path: root/src/util/disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/disk.c')
-rw-r--r--src/util/disk.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index 2bdcf3262..ba5d159e4 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -206,6 +206,26 @@ GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h)
206 206
207 207
208/** 208/**
209 * Get the size of an open file.
210 *
211 * @param fh open file handle
212 * @param size where to write size of the file
213 * @return GNUNET_OK on success, GNUNET_SYSERR on error
214 */
215int
216GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh,
217 off_t *size)
218{
219 struct stat sbuf;
220
221 if (0 != FSTAT (fh->fd, &sbuf))
222 return GNUNET_SYSERR;
223 *size = sbuf.st_size;
224 return GNUNET_OK;
225}
226
227
228/**
209 * Move the read/write pointer in a file 229 * Move the read/write pointer in a file
210 * 230 *
211 * @param h handle of an open file 231 * @param h handle of an open file