tools/hotplug: Fix hotplug hook script arrangements not to always fail

The new feature introduced in 23401:a44b12ee2fd3 was broken; it in
general always fails, at least if there are no hotplug scripts.

If there are no hooks, call_hooks ends up running this:
  [ -x ".....*.hook" ] && . "..... *.hook"

This does not directly trigger set -e and sigerr.  However, it is the
last command exected in call_hooks.  So the return status of
call_hooks is an error, and thus a sigerr happens when call_hooks
returns.

The bug affects xl and xm.  However xl does not detect failure of the
hotplug script.

Change the script to use if...then rather than &&, as the latter has
very confusing and undesirable semantics.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Ian Jackson committed 2011-06-03 15:04:30 +01:00
1 parent 46051f0c1c
commit 4bf3ca7bdb
1 file changed
+1 -1
+1 -1
View File
@@ -106,7 +106,7 @@ xenstore_write() {
#
call_hooks() {
for f in /etc/xen/scripts/${1}-${2}.d/*.hook; do
[ -x "$f" ] && . "$f"
if [ -x "$f" ]; then . "$f"; fi
done
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.