diff options
-rwxr-xr-x | tests/mv/setup | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/mv/setup b/tests/mv/setup index 6b03482b6..591b80f23 100755 --- a/tests/mv/setup +++ b/tests/mv/setup @@ -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 |