mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 18:56:39 +02:00
(dot_mount_point): Use stat rather than df, as
it's more reliable. (other_partition_tmpdir): Remove df from name as that would be misleading now.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user