From: Ulrich Drepper Date: Tue, 18 Jan 2000 10:05:40 +0000 (+0000) Subject: Don't use fstatvfs since the open call would require read permission. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae90e6aebaf13170f9bda9cf2ffd257ee89c3561;p=thirdparty%2Fglibc.git Don't use fstatvfs since the open call would require read permission. --- diff --git a/sysdeps/unix/sysv/linux/statvfs.c b/sysdeps/unix/sysv/linux/statvfs.c index 74c4985fe14..9bbe6c2f99d 100644 --- a/sysdeps/unix/sysv/linux/statvfs.c +++ b/sysdeps/unix/sysv/linux/statvfs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -26,21 +26,15 @@ int statvfs (const char *file, struct statvfs *buf) { - int save_errno; - int retval; - int fd; + struct statfs fsbuf; + struct stat st; - fd = __open (file, O_RDONLY); - if (fd < 0) + /* Get as much information as possible from the system. */ + if (__statfs (fd, &fsbuf) < 0) return -1; - /* Let fstatvfs do the real work. */ - retval = fstatvfs (fd, buf); - - /* Close the file while preserving the error number. */ - save_errno = errno; - __close (fd); - __set_errno (save_errno); - - return retval; +#include "internal_statvfs.c" + + /* We signal success if the statfs call succeeded. */ + return 0; }