summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Shapovalov <intelfx100@gmail.com>2013-05-17 19:12:01 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2013-05-17 20:26:46 +0200
commitc2b31233b0f33e9171080bc9eb84b15f2648d258 (patch)
tree55419be957199135c0c7081324e7080e705668ef /src
parentfe5f0d6fe5f30b0211d8078060147b0764abe6a8 (diff)
downloadnetctl-c2b31233b0f33e9171080bc9eb84b15f2648d258.tar.gz
netctl-c2b31233b0f33e9171080bc9eb84b15f2648d258.tar.xz
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: Ivan Shapovalov <intelfx100@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/globals2
1 files changed, 1 insertions, 1 deletions
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