Change approach how to check whether directory is writable
Closes-Bug: 1630561 Change-Id: I4af7d480cc4481ffa8c91a599aec2458f4124d6f
This commit is contained in:
parent
e0d116272a
commit
594842a63e
|
@ -686,11 +686,15 @@ 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
|
||||
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
|
||||
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;
|
||||
done
|
||||
|
||||
if [ -f /tmp/wsrep-init-file ]; then
|
||||
|
|
Loading…
Reference in New Issue