Commit c2b31233 authored by Ivan Shapovalov's avatar Ivan Shapovalov Committed by Jouke Witteveen
Browse files

Properly check existence of a connection type.



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: default avatarIvan Shapovalov <intelfx100@gmail.com>
parent fe5f0d6f
...@@ -109,7 +109,7 @@ load_profile() { ...@@ -109,7 +109,7 @@ load_profile() {
if [[ -z $Interface ]]; then if [[ -z $Interface ]]; then
exit_error "Profile '$1' does not specify an interface" exit_error "Profile '$1' does not specify an interface"
fi 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" exit_error "Profile '$1' does not specify a valid connection"
fi fi
if [[ -x "$PROFILE_DIR/interfaces/$Interface" ]]; then if [[ -x "$PROFILE_DIR/interfaces/$Interface" ]]; then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment