rpm/lazystatfs.diff

51 lines
1.9 KiB
Diff

Prefer sys/vfs.h, as statvfs stats all filesystems again
--- ./configure.ac.orig 2011-05-12 12:36:32.000000000 +0000
+++ ./configure.ac 2011-05-12 12:36:42.000000000 +0000
@@ -402,25 +402,25 @@ dnl
found_struct_statfs=no
if test X$found_struct_statfs = Xno ; then
-dnl Solaris 2.6+ wants to use statvfs
+dnl first try including sys/vfs.h
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
- AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
- [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
+#include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
+ AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
found_struct_statfs=yes],[])
fi
if test X$found_struct_statfs = Xno ; then
-dnl first try including sys/vfs.h
+dnl Solaris 2.6+ wants to use statvfs
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
- AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
+#include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
+ AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
+ [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
found_struct_statfs=yes],[])
fi
--- ./lib/transaction.c.orig 2011-05-12 12:36:55.000000000 +0000
+++ ./lib/transaction.c 2011-05-12 12:38:03.000000000 +0000
@@ -114,7 +114,11 @@ static rpmDiskSpaceInfo rpmtsCreateDSI(c
dsi->bneeded = 0;
dsi->ineeded = 0;
#ifdef STATFS_HAS_F_BAVAIL
+# ifdef ST_RDONLY
dsi->bavail = (sfb.f_flag & ST_RDONLY) ? 0 : sfb.f_bavail;
+# else
+ dsi->bavail = sfb.f_bavail;
+# endif
#else
/* FIXME: the statfs struct doesn't have a member to tell how many blocks are
* available for non-superusers. f_blocks - f_bfree is probably too big, but