From: Christian Grothoff Date: Thu, 15 Dec 2011 18:44:52 +0000 (+0000) Subject: -LRN: w32 version of fstat X-Git-Tag: initial-import-from-subversion-38251~15625 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=336fac04f09040802dcea71558afa3b9d1eff07a;p=oweals%2Fgnunet.git -LRN: w32 version of fstat --- diff --git a/src/util/disk.c b/src/util/disk.c index ba5d159e4..0c9093fbc 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -216,11 +216,23 @@ int GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, off_t *size) { +#if WINDOWS + BOOL b; + LARGE_INTEGER li; + b = GetFileSizeEx (fh->h, &li); + if (!b) + { + SetErrnoFromWinError (GetLastError ()); + return GNUNET_SYSERR; + } + *size = (off_t) li.QuadPart; +#else struct stat sbuf; if (0 != FSTAT (fh->fd, &sbuf)) return GNUNET_SYSERR; *size = sbuf.st_size; +#endif return GNUNET_OK; }