From bda73e2f353267dc3d7ba16dcebacbc80b937ed7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 26 Jan 2008 20:36:14 +0000 Subject: [PATCH] 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. --- source/blender/blenlib/intern/storage.c | 19 +++++++++++++------ 1 file 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 #include -#if !defined(linux) && (defined(__sgi) || defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__)) +#if defined (__sun__) || defined (__sun) +#include /* Other modern unix os's should probably use this also */ +#elif !defined(linux) && (defined(__sgi) || defined(__sparc) || defined(__sparc__)) #include #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));