summary refs log tree commit diff
path: root/io
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-26 02:24:09 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-26 02:24:09 +0000
commit85471284c726eec22a38f2652cde279678381ab9 (patch)
tree74457a7da63ab4e0512b0b5251d282bda63ad110 /io
parent106599818f03d43df1cf58e236bd3969e4691fa5 (diff)
downloadglibc-85471284c726eec22a38f2652cde279678381ab9.tar.gz
glibc-85471284c726eec22a38f2652cde279678381ab9.tar.xz
glibc-85471284c726eec22a38f2652cde279678381ab9.zip
Update.
	* io/test-lfs.c (do_prepare): Rewrite so it doesn't fail on systems
	without LFS support.
Diffstat (limited to 'io')
-rw-r--r--io/test-lfs.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/io/test-lfs.c b/io/test-lfs.c
index 16b2be9718..f4aa67f96a 100644
--- a/io/test-lfs.c
+++ b/io/test-lfs.c
@@ -50,6 +50,7 @@ void
 do_prepare (int argc, char *argv[])
 {
   char name_len;
+  struct rlimit64 rlim;
 
   name_len = strlen (test_dir);
   name = malloc (name_len + sizeof ("/lfsXXXXXX"));
@@ -58,24 +59,33 @@ do_prepare (int argc, char *argv[])
   add_temp_file (name);
 
   /* Open our test file.   */
-  if (mktemp (name) == NULL)
-    error (EXIT_FAILURE, errno, "cannot create temporary file name");
-
-  fd = open64 (name, O_CREAT|O_TRUNC|O_RDWR, 0666);
-  if (fd == -1 && errno == ENOSYS)
+  fd = mkstemp64 (name);
+  if (fd == -1)
     {
-      /* Fail silently.  */
-      error (0, errno, "open64 is not supported");
-      exit (EXIT_SUCCESS);
+      if (errno == ENOSYS)
+	{
+	  /* Fail silently.  */
+	  error (0, errno, "open64 is not supported");
+	  exit (EXIT_SUCCESS);
+	}
+      else
+	error (EXIT_FAILURE, errno, "cannot create temporary file");
     }
 
-  if (fd == -1)
-    error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
-
-  if (setrlimit64 (RLIMIT_FSIZE, &((const struct rlimit64)
-                                   { RLIM_INFINITY, RLIM_INFINITY }))
-      == -1)
-    error (EXIT_FAILURE, errno, "cannot reset file size limits");
+  if (getrlimit64 (RLIMIT_FSIZE, &rlim) != 0)
+    {
+      error (0, errno, "cannot get resource limit");
+      exit (0);
+    }
+  if (rlim.rlim_cur < TWO_GB + 200)
+    {
+      rlim.rlim_cur = TWO_GB + 200;
+      if (setrlimit64 (RLIMIT_FSIZE, &rlim) != 0)
+	{
+	  error (0, errno, "cannot reset file size limits");
+	  exit (0);
+	}
+    }
 }
 
 int