1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-10 11:35:00 -05:00

diskspace: add the actually used statfs type in ifdefs

Some systems, like FreeBSD might define both statfs
and statvfs: however if statvfs exists whereas getmntinfo()
uses a statfs struct, the current ifdefs would select the wrong
line of code.

Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Rémy Oudompheng 2011-04-05 01:37:09 +02:00 committed by Dan McGee
parent 272e9b355b
commit f888283910
2 changed files with 9 additions and 2 deletions

View File

@ -123,6 +123,13 @@ extern int getmntinfo (struct statfs **, int);
)
AC_DEFINE_UNQUOTED(FSSTATSTYPE, [$fs_stats_cv_type],
[Defined as the filesystem stats type ('statvfs' or 'statfs')])
if test $ac_cv_func_getmntinfo = yes; then
if test "$fs_stats_cv_type" = "struct statvfs"; then
AC_DEFINE([HAVE_GETMNTINFO_STATVFS], 1, [Define if getmntinfo() uses statvfs.])
else
AC_DEFINE([HAVE_GETMNTINFO_STATFS], 1, [Define if getmntinfo() uses statfs.])
fi
fi
])
dnl Checks for PATH_MAX and defines it if not present

View File

@ -112,9 +112,9 @@ static alpm_list_t *mount_point_list(void)
mp->mount_dir = strdup(fsp->f_mntonname);
mp->mount_dir_len = strlen(mp->mount_dir);
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
#if defined HAVE_STRUCT_STATVFS_F_FLAG
#if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG)
mp->read_only = fsp->f_flag & ST_RDONLY;
#elif defined HAVE_STRUCT_STATFS_F_FLAGS
#elif defined(HAVE_GETMNTINFO_STATFS) && defined(HAVE_STRUCT_STATFS_F_FLAGS)
mp->read_only = fsp->f_flags & MNT_RDONLY;
#endif