Commit dd3a9012 authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Pavel Emelyanov

systemd-autofs-restart.sh: explicitly return result from get_fs_type

This helper uses other binaries (like awk), which can fail or be killed.
It this case might be, that no mountpoint is found.
Or, on other hand, the whole mount point path is wrong, and is absend in
mountinfo.
Return explicit error in this case.
Without this patch, script will proceed further, and, since returned value is
empty, it doesn't equal to "autofs", so script will try to bind-mount autofs
mount, resulting in hung.

 travis-ci: success for systemd-autofs-restart.sh: explicitly return result from get_fs_type
Signed-off-by: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 4e3d0f7d
...@@ -73,7 +73,13 @@ function get_fs_type { ...@@ -73,7 +73,13 @@ function get_fs_type {
top_mount_fs_type=$mnt_fs_type top_mount_fs_type=$mnt_fs_type
done < "/proc/$CRTOOLS_INIT_PID/mountinfo" done < "/proc/$CRTOOLS_INIT_PID/mountinfo"
if [ -z "$top_mount_fs_type" ]; then
echo "Failed to find $mountpoint mountpoint"
return 1
fi
echo $top_mount_fs_type echo $top_mount_fs_type
return 0
} }
function bind_mount { function bind_mount {
...@@ -92,7 +98,7 @@ function save_mountpoint { ...@@ -92,7 +98,7 @@ function save_mountpoint {
top_mount_fs_type=$(get_fs_type $mountpoint) top_mount_fs_type=$(get_fs_type $mountpoint)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to discover $mountpoint mount point type" echo "$top_mount_fs_type"
return return
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment