dispatcher: only evaluate the number of the scripts if the request is still there
authorLubomir Rintel <lkundrak@v3.sk>
Tue, 12 Jan 2016 14:32:16 +0000 (15:32 +0100)
committerLubomir Rintel <lkundrak@v3.sk>
Tue, 12 Jan 2016 14:48:03 +0000 (15:48 +0100)
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=<error reading variable: value has been optimized out>, script=<error reading variable: value has been optimized out>) at nm-dispatcher.c:349
  349                     if (   script->request->num_scripts_nowait == 0
  (gdb) bt
  #0  0x00007f6c916ad0fb in complete_script (script=<error reading variable: value has been optimized out>, script=<error reading variable: value has been optimized out>) at nm-dispatcher.c:349
  #1  0x00007f6c8f02d484 in g_child_watch_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) 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=<optimized out>) 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

index ee972fa..7106103 100644 (file)
@@ -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;