diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-01-26 23:36:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-01-26 23:36:14 +0300 |
commit | bda73e2f353267dc3d7ba16dcebacbc80b937ed7 (patch) | |
tree | 2a802f069f895be5d3b5bdbc4d6c21d04ab0e4ea | |
parent | b606f5e0fa3fea56bca63358fd10bead754795d8 (diff) |
solaris was crashing on file open because of statfs, aparently linux-standards-base and solaris have depricated statfs so probably all unix os's should use statvfs. for now only solaris does.
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index c6011bb6fd9..5902b7dd68a 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -50,7 +50,9 @@ #include <time.h> #include <sys/stat.h> -#if !defined(linux) && (defined(__sgi) || defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__)) +#if defined (__sun__) || defined (__sun) +#include <sys/statvfs.h> /* Other modern unix os's should probably use this also */ +#elif !defined(linux) && (defined(__sgi) || defined(__sparc) || defined(__sparc__)) #include <sys/statfs.h> #endif @@ -179,7 +181,12 @@ double BLI_diskfree(char *dir) return (double) (freec*bytesps*sectorspc); #else + +#if defined (__sun__) || defined (__sun) + struct statvfs disk; +#else struct statfs disk; +#endif char name[FILE_MAXDIR],*slash; int len = strlen(dir); @@ -199,12 +206,12 @@ double BLI_diskfree(char *dir) #ifdef __BeOS return -1; #endif -#if !defined(linux) && (defined (__sgi) || defined (__sun__) || defined (__sun) || defined(__sparc) || defined(__sparc__)) - if (statfs(name, &disk, sizeof(struct statfs), 0)){ - /* printf("diskfree: Couldn't get information about %s.\n",dir); */ - return(-1); - } +#if defined (__sun__) || defined (__sun) + if (statvfs(name, &disk)) return(-1); +#elif !defined(linux) && (defined (__sgi) || defined(__sparc) || defined(__sparc__)) + /* WARNING - This may not be supported by geeneric unix os's - Campbell */ + if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1); #endif return ( ((double) disk.f_bsize) * ((double) disk.f_bfree)); |