Skip to content
Snippets Groups Projects
Commit abeb59fe authored by yorhel's avatar yorhel
Browse files

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
parent 8a71f886
No related branches found
No related tags found
No related merge requests found
...@@ -311,7 +311,7 @@ int calcDir(struct dir *dest, char *path) { ...@@ -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) { ...@@ -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 @@ ...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment