summaryrefslogtreecommitdiffstats
path: root/xlators/mount
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2012-05-18 09:39:23 +0200
committerAnand Avati <avati@redhat.com>2012-05-18 19:15:11 -0700
commitb0a243a6351db8acd943ba6cfb3935fa063a4fee (patch)
tree9698f5814f2dd95126426809db342c4f3d58901e /xlators/mount
parent5b6c82cfc0d07981b618fe5a7bd7f4125de9e6a4 (diff)
stat(1) portability fix
stat(1) flag to specify format is not portable. This change works that around and makes the script a bit more readable: ${getinode} instead of stat -c %i BUG: 764655 Change-Id: Iae3c40b03118078530c29d14d5f7180c36361c16 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.com/3362 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mount')
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in42
1 files changed, 26 insertions, 16 deletions
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 1eae61ad8cb..cc21ba5e928 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -31,6 +31,25 @@ _init ()
exec_prefix=@exec_prefix@;
cmd_line=$(echo "@sbindir@/glusterfs");
+ case `uname -s` in
+ NetBSD)
+ getinode="stat -f %i"
+ getdev="stat -f %d"
+ lgetinode="${getinode} -L"
+ lgetdev="${getdev} -L"
+
+ mounttab=/proc/mounts
+ ;;
+ Linux)
+ getinode="stat -c $i"
+ getdev="stat -c $d"
+ lgetinode="${getinode} -L"
+ lgetdev="${getdev} -L"
+
+ mounttab=/etc/mtab
+ ;;
+ esac
+
UPDATEDBCONF=/etc/updatedb.conf
}
@@ -50,7 +69,7 @@ wait_for ()
umount $mount_point &> /dev/null
exit 1
fi
- inode=$(stat -c %i $mount_point 2>/dev/null);
+ inode=$( ${getinode} $mount_point 2>/dev/null);
if [ "$inode" = "1" ]; then
break
fi
@@ -234,10 +253,10 @@ check_recursive_mount ()
fi
brick_path=`grep ^path "$GLUSTERD_WORKDIR"/vols/*/bricks/* | cut -d "=" -f 2`;
- root_inode=`stat -Lc %i /`;
- root_dev=`stat -Lc %d /`;
- mnt_inode=`stat -Lc %i $mnt_dir`;
- mnt_dev=`stat -Lc %d $mnt_dir`;
+ root_inode=`${lgetinode} /`;
+ root_dev=`${lgetdev} /`;
+ mnt_inode=`${lgetinode} $mnt_dir`;
+ mnt_dev=`${lgetdev} $mnt_dir`;
for brick in "$brick_path";
do
# evaluate brick path to see if this is local, if non-local, skip iteration
@@ -254,8 +273,8 @@ check_recursive_mount ()
do
tmp_brick="$brick";
brick="$brick"/..;
- brick_dev=`stat -Lc %d $brick`;
- brick_inode=`stat -Lc %i $brick`;
+ brick_dev=`${lgetdev} $brick`;
+ brick_inode=`${gletdev} $brick`;
if [ "$mnt_inode" -eq "$brick_inode" -a "$mnt_dev" -eq "$brick_dev" ]; then
echo ERROR: $mnt_dir is a parent of the brick $tmp_brick;
exit 2;
@@ -343,15 +362,6 @@ main ()
exit 0;
}
- case `uname -s` in
- NetBSD)
- mounttab=/proc/mounts
- ;;
- Linux)
- mounttab=/etc/mtab
- ;;
- esac
-
# Simple check to avoid multiple identical mounts
if grep -q " ${mount_point}.*fuse" $mounttab; then
echo -n "$0: according to mtab, GlusterFS is already mounted on "