[arch-projects] [netctl] [PATCH] Properly check existence of a connection type.

Jouke Witteveen j.witteveen at gmail.com
Fri May 17 15:50:26 EDT 2013


On Fri, May 17, 2013 at 7:12 PM, Ivan Shapovalov <intelfx100 at gmail.com> wrote:
> Substituting "/dev/null/nonexistent" for an empty $Connection,
> of course, does generally work, but is somewhat ugly (esp. in that
> the string is appended to $CONN_DIR, so the resulting path may
> theoretically exist).
>
> Instead, substitute an empty string for the complete path if $Connection
> is empty: an empty string can never be readable.
>
> Signed-off-by: Ivan Shapovalov <intelfx100 at gmail.com>
> ---
>  src/lib/globals | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/globals b/src/lib/globals
> index 1d7feea..83c64a2 100644
> --- a/src/lib/globals
> +++ b/src/lib/globals
> @@ -109,7 +109,7 @@ load_profile() {
>      if [[ -z $Interface ]]; then
>          exit_error "Profile '$1' does not specify an interface"
>      fi
> -    if [[ ! -r "$CONN_DIR/${Connection:-/dev/null/nonexistent}" ]]; then
> +    if [[ ! -r "${Connection:+$CONN_DIR/$Connection}" ]]; then
>          exit_error "Profile '$1' does not specify a valid connection"
>      fi
>      if [[ -x "$PROFILE_DIR/interfaces/$Interface" ]]; then
> --
> 1.8.2.3
>
>

Applied. Thanks,
- Jouke


More information about the arch-projects mailing list