From: Will Woods Date: Fri, 20 Apr 2012 20:20:24 +0000 (-0400) Subject: url-lib: don't add existing handlers multiple times X-Git-Tag: 019~94 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6a91ec9928f7f09dd70ad597bf96ac60f6b652d;p=thirdparty%2Fdracut.git url-lib: don't add existing handlers multiple times Every time url-lib gets imported we end up making the list of handlers longer with redundant entries. That's silly - we shouldn't add items that already exist. Note that this means you'll have to manipulate the handler list yourself if you want to change the position/priority of existing handlers. --- diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh index e305a68a5..793014698 100755 --- a/modules.d/45url-lib/url-lib.sh +++ b/modules.d/45url-lib/url-lib.sh @@ -43,6 +43,7 @@ add_url_handler() { local schemes="$@" scheme="" set -- for scheme in $schemes; do + [ "$(get_url_handler $scheme)" = "$handler" ] && continue set -- "$@" "$scheme:$handler" done set -- $@ $url_handler_map # add new items to *front* of list