Wait for create_ap to exit after AP-ENABLED in UI #474
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To create a hotspot, the UI launches
create_apwithpopenand waits for it to print "AP-ENABLED" to confirm the hotspot has been created. When this happens, it immediately returns, without callingpclose.This not only leaks the
FILE *opened bypopen, but it can also inadvertently causecreate_apto get terminated:wihotspot-guias rootwihotspot-guilaunchespkexec --user root create_ap ...pkexecsets aSIGTERMparent-death signal viaprctlpkexeclaunchescreate_apand it starts runningcreate_apcreates the hotspot and prints "AP-ENABLED"wihotspot-guiupdates the UI, and returns without waiting forcreate_apto exitinit_running_infothread exitsSIGTERMparent-death signal is sent tocreate_apcreate_apterminates and the hotspot stops running(This only reproduces if
wihotspot-guiruns as root, likely due to setuid restrictions forprctlapplying otherwise)Wait for
create_apto exit usingpcloseto fix the problem.