mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Bugfix for systems that don't have an S_BLKSIZE of 512
git-svn-id: svn://blicky.net/ncdu/trunk@29 ce56bc8d-f834-0410-b703-f827bd498a76
This commit is contained in:
parent
8a71f8860c
commit
abeb59fe30
2 changed files with 7 additions and 2 deletions
|
|
@ -311,7 +311,7 @@ int calcDir(struct dir *dest, char *path) {
|
||||||
|
|
||||||
/* count the size */
|
/* count the size */
|
||||||
if(!(d->flags & FF_EXL || d->flags & FF_OTHFS)) {
|
if(!(d->flags & FF_EXL || d->flags & FF_OTHFS)) {
|
||||||
d->size = fs.st_blocks * 512;
|
d->size = fs.st_blocks * S_BLKSIZE;
|
||||||
d->asize = fs.st_size;
|
d->asize = fs.st_size;
|
||||||
for(t = dest; t != NULL; t = t->parent) {
|
for(t = dest; t != NULL; t = t->parent) {
|
||||||
t->size += d->size;
|
t->size += d->size;
|
||||||
|
|
@ -376,7 +376,7 @@ struct dir *showCalc(char *path) {
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
parent = calloc(sizeof(struct dir), 1);
|
parent = calloc(sizeof(struct dir), 1);
|
||||||
parent->size = fs.st_blocks * 512;
|
parent->size = fs.st_blocks * S_BLKSIZE;
|
||||||
parent->asize = fs.st_size;
|
parent->asize = fs.st_size;
|
||||||
parent->flags |= FF_DIR;
|
parent->flags |= FF_DIR;
|
||||||
curdev = fs.st_dev;
|
curdev = fs.st_dev;
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,11 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
|
/* set S_BLKSIZE if not defined already in sys/stat.h */
|
||||||
|
#ifndef S_BLKSIZE
|
||||||
|
# define S_BLKSIZE 512
|
||||||
|
#endif
|
||||||
|
|
||||||
/* PATH_MAX 260 on Cygwin is too small for /proc/registry */
|
/* PATH_MAX 260 on Cygwin is too small for /proc/registry */
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
# if PATH_MAX < 1024
|
# if PATH_MAX < 1024
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue