[arch-projects] [devtools] [PATCH 3/3] common: remove unreachable statement
Dave Reisner
d at falconindy.com
Sat May 10 20:04:59 EDT 2014
On Sat, May 10, 2014 at 09:44:34AM -0400, Dave Reisner wrote:
> We run from a non-interactive shell, so the exec which is inevitably
> called will replace the current process and 'die' will never run under
> any circumstances.
>
> This also fixes a bug with the su fallback which would cause multiple
> arguments to be concatenated without any whitespace between them.
> ---
> lib/common.sh | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/common.sh b/lib/common.sh
> index b885080..1798773 100644
> --- a/lib/common.sh
> +++ b/lib/common.sh
> @@ -237,7 +237,6 @@ check_root() {
> if type -P sudo >/dev/null; then
> exec sudo -- "$@"
> else
Perhaps it would be better to not assume that su exists here, check for
it, and then fall back on the 'die'.
> - exec su root -c "$(printf '%q' "$@")"
> + exec su root -c "$(printf ' %q' "$@")"
> fi
> - die 'This script must be run as root.'
> }
> --
> 1.9.2
>
More information about the arch-projects
mailing list