about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-10-27 04:05:04 +0000
committerUlrich Drepper <drepper@redhat.com>2003-10-27 04:05:04 +0000
commita14f121d3edf326ffef2f3dea5d9adfe673cba81 (patch)
tree7116ec85a61c1c0c83f9db632817f69716351c33 /sysdeps
parent5a4b5076f1e002ebb43ccbab7d84dfa76d96146e (diff)
downloadglibc-a14f121d3edf326ffef2f3dea5d9adfe673cba81.tar.gz
glibc-a14f121d3edf326ffef2f3dea5d9adfe673cba81.tar.xz
glibc-a14f121d3edf326ffef2f3dea5d9adfe673cba81.zip
Update.
	* sysdeps/unix/sysv/linux/internal_statvfs.c (__internal_statvfs):
	Avoid infinite loops in case the mounts file is hosed.
	* io/Makefile: Add rules to build and run tst-statvfs.
	* io/tst-statvfs.c: New file.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/internal_statvfs.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c
index 172113d496..b2d882ece1 100644
--- a/sysdeps/unix/sysv/linux/internal_statvfs.c
+++ b/sysdeps/unix/sysv/linux/internal_statvfs.c
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <mntent.h>
 #include <paths.h>
@@ -167,14 +168,17 @@ __internal_statvfs (const char *name, struct statvfs *buf,
 	     statvfs call got a name which was not the mount point.
 	     Check again, this time without checking for name matches
 	     first.  */
-	  if (! success)
+	  if (! success && (name != NULL || fsname != NULL))
 	    {
 	      if (name != NULL)
 		/* Try without a mount point name.  */
 		name = NULL;
-	      else if (fsname != NULL)
-		/* Try without a filesystem name.  */
-		fsname = fsname2 = NULL;
+	      else
+		{
+		  /* Try without a filesystem name.  */
+		  assert (fsname != NULL);
+		  fsname = fsname2 = NULL;
+		}
 
 	      /* It is not strictly allowed to use rewind here.  But
 		 this code is part of the implementation so it is