diff options
author | dkf <dkf@noemail.net> | 2009-12-28 12:55:47 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2009-12-28 12:55:47 (GMT) |
commit | b227247010f3a176bb24c6a1779d0ad95071870b (patch) | |
tree | bd4dc4243a573408e161da4ffd15e03e13792cd4 /generic/tclFileName.c | |
parent | 0bcfabbac74adef28e4838f06c6fcd0281c69f8c (diff) | |
download | tcl-b227247010f3a176bb24c6a1779d0ad95071870b.zip tcl-b227247010f3a176bb24c6a1779d0ad95071870b.tar.gz tcl-b227247010f3a176bb24c6a1779d0ad95071870b.tar.bz2 |
[Bug 942170]: Detect the st_blocks field of 'struct stat' correctly.
FossilOrigin-Name: ce4adf55c782a8ccc0803aecabb2be890af6a0b3
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r-- | generic/tclFileName.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 664ba94..8a25eb4 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFileName.c,v 1.99 2009/12/21 23:25:40 nijtmans Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.100 2009/12/28 12:55:48 dkf Exp $ */ #include "tclInt.h" @@ -46,7 +46,7 @@ static int DoGlob(Tcl_Interp *interp, Tcl_Obj *resultPtr, * specific files. */ -#if (!defined(HAVE_ST_BLOCKS) && !defined(GUESSED_BLOCK_SIZE)) +#if (!defined(HAVE_STRUCT_STAT_ST_BLKSIZE) && !defined(GUESSED_BLOCK_SIZE)) #define GUESSED_BLOCK_SIZE 1024 #endif @@ -2672,11 +2672,12 @@ Tcl_WideUInt Tcl_GetBlocksFromStat( const Tcl_StatBuf *statPtr) { -#ifdef HAVE_ST_BLOCKS +#ifdef HAVE_STRUCT_STAT_ST_BLOCKS return (Tcl_WideUInt) statPtr->st_blocks; #else - return ((Tcl_WideUInt) statPtr->st_size - + (GUESSED_BLOCK_SIZE-1)) / GUESSED_BLOCK_SIZE; + register unsigned blksize = Tcl_GetBlockSizeFromStat(statPtr); + + return ((Tcl_WideUInt) statPtr->st_size + blksize - 1) / blksize; #endif } @@ -2684,7 +2685,7 @@ unsigned Tcl_GetBlockSizeFromStat( const Tcl_StatBuf *statPtr) { -#ifdef HAVE_ST_BLOCKS +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE return (unsigned) statPtr->st_blksize; #else /* |