Revert "Change approach how to check whether directory is writable"

This reverts commit 594842a63e.

This approach doesn't work for ACLs.

Change-Id: Ic04dc832c966c282fe728dbbd50783464d6a4d3a
This commit is contained in:
Oleksiy Molchanov 2016-11-09 13:14:11 +00:00
parent fdb38df92a
commit f8bba32c37
1 changed files with 4 additions and 8 deletions

View File

@ -686,15 +686,11 @@ mysql_start() {
# Regardless of whether we just created the directory or it
# already existed, check whether it is writable by the configured
# user
groups=($(groups $OCF_RESKEY_user))
for dir in $pid_dir $socket_dir; do
read -a dir_stats < <(stat -Lc "%U %G %A" $dir)
[ "${dir_stats[2]:8:1}" == "w" ] && continue
[ "${dir_stats[0]}" == ${OCF_RESKEY_user} ] && [ "${dir_stats[2]:2:1}" == "w" ] && continue
[ "${dir_stats[2]:5:1}" == "w" ] && [[ "${groups[*]:2}" =~ ^(.* |)${dir_stats[1]}( .*|)$ ]] && continue
ocf_log err "${LH} Directory $dir is not writable by $OCF_RESKEY_user"
exit $OCF_ERR_PERM;
if ! su -s /bin/sh - $OCF_RESKEY_user -c "test -w $dir"; then
ocf_log err "${LH} Directory $dir is not writable by $OCF_RESKEY_user"
exit $OCF_ERR_PERM;
fi
done
if [ -f /tmp/wsrep-init-file ]; then