]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(dot_mount_point): Use stat rather than df, as
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 14 Apr 2005 20:35:34 +0000 (20:35 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 14 Apr 2005 20:35:34 +0000 (20:35 +0000)
it's more reliable.
(other_partition_tmpdir): Remove df from name as that would be
misleading now.

tests/mv/setup

index 6b03482b6a9f9fba710cdbbe070d65df374166c4..591b80f23d6749949cce0a6d8a97c783c8e64f95 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# Use df to find a writable directory on a file system different from that
+# Use stat to find a writable directory on a file system different from that
 # of the current directory.  If one is found, create a temporary directory
 # inside it.
 
@@ -9,22 +9,20 @@ test "${CANDIDATE_TMP_DIRS+set}" = set \
 
 other_partition_tmpdir=
 
-# WARNING: using sed like this to extract the mount point will fail
-# if the mount point name contains `% '.
-dot_mount_point=`df --no-sync -P . | sed -n '2s/.*%  *//p'`
+dot_mount_point=`stat -c %d .`
 for d in $CANDIDATE_TMP_DIRS; do
 
   # Skip nonexistent directories.
   test -d $d || continue
 
-  d_mount_point=`df --no-sync -P $d | sed -n '2s/.*%  *//p'`
+  d_mount_point=`stat -c %d $d`
 
   # Same partition?  Skip it.
   test x$d_mount_point = x$dot_mount_point && continue
 
   # See if we can create a directory in it.
-  if mkdir "$d/df-$$" > /dev/null 2>&1; then
-    other_partition_tmpdir="$d/df-$$"
+  if mkdir "$d/tmp$$" > /dev/null 2>&1; then
+    other_partition_tmpdir="$d/tmp$$"
     break
   fi