summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorminskim <minskim@pkgsrc.org>2004-06-01 17:29:09 +0000
committerminskim <minskim@pkgsrc.org>2004-06-01 17:29:09 +0000
commit945b1ab340ce67f716da7851cdfd29fcc937e4b6 (patch)
tree12e0ddf1893820fbe0a1645a543859eb219b9235 /pkgtools
parent733f896f3e1db2c7bcdd3521f0ab5ee52744a304 (diff)
downloadpkgsrc-945b1ab340ce67f716da7851cdfd29fcc937e4b6.tar.gz
Use statvfs if sys/statvfs.h is available. Based on patches provided
by Kibum Han in PR pkg/25560. PKGVERSION will be bumped shortly when 20040601 is imported.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/files/lib/pen.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgtools/pkg_install/files/lib/pen.c b/pkgtools/pkg_install/files/lib/pen.c
index 67708e0b7af..2a6bec8bbd0 100644
--- a/pkgtools/pkg_install/files/lib/pen.c
+++ b/pkgtools/pkg_install/files/lib/pen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pen.c,v 1.12 2003/09/23 07:13:53 grant Exp $ */
+/* $NetBSD: pen.c,v 1.13 2004/06/01 17:29:09 minskim Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
#else
-__RCSID("$NetBSD: pen.c,v 1.12 2003/09/23 07:13:53 grant Exp $");
+__RCSID("$NetBSD: pen.c,v 1.13 2004/06/01 17:29:09 minskim Exp $");
#endif
#endif
@@ -51,6 +51,9 @@ __RCSID("$NetBSD: pen.c,v 1.12 2003/09/23 07:13:53 grant Exp $");
#if HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
/* For keeping track of where we are */
static char Current[FILENAME_MAX];
@@ -208,10 +211,17 @@ leave_playpen(char *save)
uint64_t
min_free(char *tmpdir)
{
+#ifdef HAVE_SYS_STATVFS_H
+ struct statvfs buf;
+
+ if (statvfs(tmpdir, &buf) != 0) {
+ warn("statvfs");
+#else
struct statfs buf;
if (statfs(tmpdir, &buf) != 0) {
warn("statfs");
+#endif
return -1;
}
return (uint64_t) buf.f_bavail * (uint64_t) buf.f_bsize;