Subject: pkg/35928: blender modern solaris 64bit gcc
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Gilles Dauphin <dauphin@enst.fr>
List: pkgsrc-bugs
Date: 03/05/2007 18:20:01
>Number:         35928
>Category:       pkg
>Synopsis:       blender modern solaris 64bit gcc
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 05 18:20:00 +0000 2007
>Originator:     Gilles Dauphin
>Release:        SunOS 5.10 i86pc
>Organization:
ENST 
>Environment:


System: SunOS bi.enst.fr 5.10 Generic_118855-19 i86pc


>Description:


blender crash when saving file or opening one
problem is in source/blender/blenlib/intern/storage.c
statfs() is not available on 64bit ABI. its an obsolete feature.
use statvfs instead


>How-To-Repeat:


run blender on solaris


>Fix:


--- patch-ab begins here ---
--- source/blender/blenlib/intern/storage.c.orig	Wed Jul 27 22:16:37 2005
+++ source/blender/blenlib/intern/storage.c	Mon Mar  5 18:57:10 2007
@@ -50,7 +50,11 @@
 #include <time.h>
 #include <sys/stat.h>
 
-#if !defined(linux) && (defined(__sgi) || defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__))
+#if defined(__DragonFly__) || defined(__sun__) || defined(__sun) 
+#include <sys/statvfs.h>
+#endif
+
+#if !defined(linux) && defined(__sgi) 
 #include <sys/statfs.h>
 #endif
 
@@ -89,10 +93,6 @@
 #include <pwd.h>
 #endif
 
-#if !defined(__FreeBSD__) && !defined(__APPLE__)
-#include <malloc.h>
-#endif
-
 /* lib includes */
 #include "MEM_guardedalloc.h"
 
@@ -177,7 +177,11 @@
 
 	return (double) (freec*bytesps*sectorspc);
 #else
+#if defined(__DragonFly__) || defined(__sun__) || defined(__sun) || (defined (__NetBSD__) && __NetBSD_Version__ >= 299000900) /* 2.99.9 */
+	struct statvfs disk;
+#else
 	struct statfs disk;
+#endif
 	char name[100],*slash;
 
 
@@ -188,16 +192,19 @@
 		if (slash) slash[1] = 0;
 	} else strcpy(name,"/");
 
-#if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__) 
+#if defined(__DragonFly__) || defined(__sun__) || defined(__sun) || (defined (__NetBSD__) && __NetBSD_Version__ >= 299000900) /* 2.99.9 */
+	if (statvfs(name, &disk)) return(-1);
+#elif defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || \
+      defined (__APPLE__) || defined (__NetBSD__)
 	if (statfs(name, &disk)) return(-1);
 #endif
 #ifdef __BeOS
 	return -1;
 #endif
-#if !defined(linux) && (defined (__sgi) || defined (__sun__) || defined (__sun) || defined(__sparc) || defined(__sparc__))
+#if !defined(linux) && defined (__sgi)  
 
 	if (statfs(name, &disk, sizeof(struct statfs), 0)){
-		/* printf("diskfree: Couldn't get information about %s.\n",dir); */
+		printf("diskfree: Couldn't get information about %s.\n",dir);
 		return(-1);
 	}
 #endif
--- patch-ab ends here ---