diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2019-09-21 01:04:07 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2019-09-21 01:04:07 +0300 |
commit | 6a7d51b1cb338081aa111f3ec774aaf4d90c994b (patch) | |
tree | 78bffd62b480938d83b62a8c4e959eff8ede72db /scripts | |
parent | 13c2fd36c18cbd23ae33bba538982ebceae04ac6 (diff) | |
download | mariadb-git-6a7d51b1cb338081aa111f3ec774aaf4d90c994b.tar.gz |
MDEV-19211 Fix mysqld_safe --dry-run
mysqld_safe --dry-run needs to either call exit or return, depending if
it is being sourced or not, otherise return can lead to the error:
return: can only `return' from a function or sourced script
The original fix suggestion was proposed by FaramosCZ <mschorm@centrum.cz>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mysqld_safe.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index d51867d9d17..85f66fed075 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -970,7 +970,13 @@ do cmd="$cmd "`shell_quote_string "$i"` done cmd="$cmd $args" -[ $dry_run -eq 1 ] && return + +if [ $dry_run -eq 1 ] +then + # RETURN or EXIT depending if the script is being sourced or not. + (return 2> /dev/null) && return || exit +fi + # Avoid 'nohup: ignoring input' warning test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null" |