Check that we have statfs before using it.

This commit is contained in:
Alexandre Julliard 2004-03-10 01:55:12 +00:00
parent 63fae64558
commit 86a8f4cd3c
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
@ -43,6 +44,7 @@
int statvfs( const char *path, struct statvfs *buf )
{
int ret;
#ifdef HAVE_STATFS
struct statfs info;
/* FIXME: add autoconf check for this */
@ -86,6 +88,10 @@ int statvfs( const char *path, struct statvfs *buf )
buf->f_favail = info.f_ffree;
#endif
}
#else /* HAVE_STATFS */
ret = -1;
errno = ENOSYS;
#endif /* HAVE_STATFS */
return ret;
}