From ddc6d97f00e81cd422bb4d48adcadff70018de0f Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 12 Jan 2016 15:32:16 +0100 Subject: [PATCH] dispatcher: only evaluate the number of the scripts if the request is still there The request could have been completed by the call to complete_request() just above. In that case we should just return instead of looking for nowait scripts to run. Core was generated by `/usr/libexec/nm-dispatcher'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f6c916ad0fb in complete_script (script=, script=) at nm-dispatcher.c:349 349 if ( script->request->num_scripts_nowait == 0 (gdb) bt #0 0x00007f6c916ad0fb in complete_script (script=, script=) at nm-dispatcher.c:349 #1 0x00007f6c8f02d484 in g_child_watch_dispatch (source=, callback=, user_data=) at gmain.c:5148 #2 0x00007f6c8f03079a in g_main_context_dispatch (context=0x7f6c9358d9a0) at gmain.c:3109 #3 0x00007f6c8f03079a in g_main_context_dispatch (context=context@entry=0x7f6c9358d9a0) at gmain.c:3708 #4 0x00007f6c8f030ae8 in g_main_context_iterate (context=0x7f6c9358d9a0, block=block@entry=1, dispatch=dispatch@entry=1, self=) at gmain.c:3779 #5 0x00007f6c8f030dba in g_main_loop_run (loop=0x7f6c9358da80) at gmain.c:3973 #6 0x00007f6c916abcd4 in main (argc=1, argv=0x7ffee4326768) at nm-dispatcher.c:935 (gdb) Fixes: e97a334e375b936ac66864e6d69ffe75ffa22aa9 https://bugzilla.redhat.com/show_bug.cgi?id=1297826 --- callouts/nm-dispatcher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c index ee972faad..7106103e3 100644 --- a/callouts/nm-dispatcher.c +++ b/callouts/nm-dispatcher.c @@ -346,8 +346,8 @@ complete_script (ScriptInfo *script) * requests. However, if this was the last "no-wait" script and * there are "wait" scripts ready to run, launch them. */ - if ( script->request->num_scripts_nowait == 0 - && handler->current_request == script->request) { + if ( handler->current_request == script->request + && script->request->num_scripts_nowait == 0) { if (dispatch_one_script (script->request)) return;