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=<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: e97a334e37

https://bugzilla.redhat.com/show_bug.cgi?id=1297826
This commit is contained in:
Lubomir Rintel
2016-01-12 15:32:16 +01:00
parent 49832fd394
commit ddc6d97f00

View File

@@ -346,8 +346,8 @@ complete_script (ScriptInfo *script)
* requests. However, if this was the last "no-wait" script and * requests. However, if this was the last "no-wait" script and
* there are "wait" scripts ready to run, launch them. * there are "wait" scripts ready to run, launch them.
*/ */
if ( script->request->num_scripts_nowait == 0 if ( handler->current_request == script->request
&& handler->current_request == script->request) { && script->request->num_scripts_nowait == 0) {
if (dispatch_one_script (script->request)) if (dispatch_one_script (script->request))
return; return;