Subject: pkg/25560: pkgtools/pkg_install doesn't compile due to statvfs problem.
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <yui@yui.pe.kr>
List: pkgsrc-bugs
Date: 05/14/2004 02:12:00
>Number:         25560
>Category:       pkg
>Synopsis:       pkgtools/pkg_install doesn't compile due to statvfs problem.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 14 02:13:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Kibum Han
>Release:        2.0E
>Organization:
..
>Environment:
NetBSD caspar 2.0E NetBSD 2.0E (GENERIC) #1: Tue May  4 12:00:10 KST 2004  root@caspar:/usr/obj/sys/arch/i386/compile/GENERIC i386

>Description:
recent pkgtools/pkg_install does not compile successfully.
error message is:

pen.c: In function `min_free':
pen.c:211: error: storage size of `buf' isn't known
*** Error code 1


>How-To-Repeat:
In pkgtools/pkg_install, do 'make update'

>Fix:
something like this.

--- pen.c.orig  2004-05-14 11:03:56.000000000 +0900
+++ pen.c       2004-05-14 11:06:44.000000000 +0900
@@ -51,6 +51,11 @@
 #if HAVE_SYS_VFS_H
 #include <sys/vfs.h>
 #endif
+#if (defined(__NetBSD__) && __NetBSD_Version__ >= 200040000) /* NetBSD 2.0D */
+#define USE_STATVFS
+#else
+#define USE_STATFS
+#endif

 /* For keeping track of where we are */
 static char Current[FILENAME_MAX];
@@ -208,9 +213,13 @@
 uint64_t
 min_free(char *tmpdir)
 {
+#ifdef USE_STATVFS
+       struct statvfs buf;
+       if (statvfs(tmpdir, &buf) != 0) {
+#else
        struct statfs buf;
-
        if (statfs(tmpdir, &buf) != 0) {
+#endif
                warn("statfs");
                return -1;
        }


>Release-Note:
>Audit-Trail:
>Unformatted: