struct stat.st_size is of type off_t

This commit is contained in:
Wei-keng Liao 2017-06-09 02:51:06 -05:00
parent 4097dd9826
commit 308c2f764e

View File

@ -118,16 +118,16 @@ static int ncio_spx_close(ncio *nciop, int doUnlink);
* @par fd File Descriptor.
* @return -1 on error, length of file (in bytes) otherwise.
*/
static size_t nc_get_filelen(const int fd) {
static off_t nc_get_filelen(const int fd) {
size_t flen;
off_t flen;
#ifdef HAVE_FILE_LENGTH_I64
__int64 file_len = 0;
if ((file_len = _filelengthi64(fd)) < 0) {
return file_len;
}
flen = (size_t)file_len;
flen = (off_t)file_len;
#else
int res = 0;
@ -243,7 +243,7 @@ fgrow2(const int fd, const off_t len)
*/
size_t file_len = nc_get_filelen(fd);
off_t file_len = nc_get_filelen(fd);
if(file_len < 0) return errno;
if(len <= file_len)
return NC_NOERR;