mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fiy block size for systems using statvfs.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25885 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ce895bb507
commit
c6bb86aab8
2 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-01-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSFileManager.m (-fileSystemAttributesAtPath:): Correct
|
||||
block size for systems using statvfs().
|
||||
|
||||
2008-01-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSSocketStream.m: Try to honor protocol requested.
|
||||
|
|
|
@ -1743,6 +1743,7 @@ static NSStringEncoding defaultEncoding;
|
|||
struct statfs statfsbuf;
|
||||
#endif
|
||||
unsigned long long totalsize, freesize;
|
||||
unsigned long blocksize;
|
||||
const char* lpath = [self fileSystemRepresentationWithPath: path];
|
||||
|
||||
id values[5];
|
||||
|
@ -1763,16 +1764,18 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
return nil;
|
||||
}
|
||||
blocksize = statfsbuf.f_frsize;
|
||||
#else
|
||||
if (statfs(lpath, &statfsbuf) != 0)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
blocksize = statfsbuf.f_bsize;
|
||||
#endif
|
||||
|
||||
totalsize = (unsigned long long) statfsbuf.f_bsize
|
||||
totalsize = (unsigned long long) blocksize
|
||||
* (unsigned long long) statfsbuf.f_blocks;
|
||||
freesize = (unsigned long long) statfsbuf.f_bsize
|
||||
freesize = (unsigned long long) blocksize
|
||||
* (unsigned long long) statfsbuf.f_bavail;
|
||||
|
||||
values[0] = [NSNumber numberWithUnsignedLongLong: totalsize];
|
||||
|
|
Loading…
Reference in a new issue