]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Don't use fstatvfs since the open call would require read permission.
authorUlrich Drepper <drepper@redhat.com>
Tue, 18 Jan 2000 10:05:40 +0000 (10:05 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 18 Jan 2000 10:05:40 +0000 (10:05 +0000)
sysdeps/unix/sysv/linux/statvfs.c

index 74c4985fe1435bd8e10cda6762fcde41b6c03664..9bbe6c2f99de1818ebcf1acfa3ee34eb83b0e977 100644 (file)
@@ -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 <drepper@cygnus.com>, 1998.
 
 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;
 }