summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/hook.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libalpm/hook.c b/lib/libalpm/hook.c
index fe4b2041..c7b4ee87 100644
--- a/lib/libalpm/hook.c
+++ b/lib/libalpm/hook.c
@@ -363,6 +363,11 @@ static int _alpm_hook_triggered(alpm_handle_t *handle, struct _alpm_hook_t *hook
return 0;
}
+static int _alpm_hook_cmp(struct _alpm_hook_t *h1, struct _alpm_hook_t *h2)
+{
+ return strcmp(h1->name, h2->name);
+}
+
static alpm_list_t *find_hook(alpm_list_t *haystack, const void *needle)
{
while(haystack) {
@@ -478,6 +483,9 @@ int _alpm_hook_run(alpm_handle_t *handle, enum _alpm_hook_when_t when)
closedir(d);
}
+ hooks = alpm_list_msort(hooks, alpm_list_count(hooks),
+ (alpm_list_fn_cmp)_alpm_hook_cmp);
+
for(i = hooks; i; i = i->next) {
struct _alpm_hook_t *hook = i->data;
if(hook && hook->when == when && _alpm_hook_triggered(handle, hook)) {