-
Notifications
You must be signed in to change notification settings - Fork 3
Improve WPS execution error handling and result parsing #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,14 +115,21 @@ public boolean isLocked() { | |
| * @return true if first 4 digits are correct (M6 failure or later) | ||
| */ | ||
| public boolean isFirstHalfCorrect() { | ||
| // Scan all results before concluding — an M6 in any position wins over an earlier M4, | ||
| // which matters when WpsResult aggregates multiple CommandResults (e.g. Pixie Dust). | ||
| for (CommandResult result : commandResults) { | ||
| String output = result.getOutputAsString().toLowerCase(Locale.ROOT); | ||
| // M6 failure indicates first half was correct | ||
| if (output.contains("m6") || output.contains("wsc_nack after m6")) { | ||
| // M6 failure (msg=10) indicates first half was correct, second half wrong | ||
| if (output.contains("m6") || output.contains("wsc_nack after m6") | ||
| || output.contains("msg=10")) { | ||
| return true; | ||
| } | ||
| // M4 failure indicates first half was wrong | ||
| if (output.contains("m4") || output.contains("wsc_nack after m4")) { | ||
| } | ||
| for (CommandResult result : commandResults) { | ||
| String output = result.getOutputAsString().toLowerCase(Locale.ROOT); | ||
| // M4 failure (msg=8) indicates first half was wrong | ||
| if (output.contains("m4") || output.contains("wsc_nack after m4") | ||
| || output.contains("msg=8")) { | ||
| return false; | ||
|
Comment on lines
117
to
133
|
||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waitpid(pid, &status, 0)return value isn’t checked. Ifwaitpidfails,statusis undefined and the subsequentWIFSIGNALED/WIFEXITEDhandling and logging can read garbage. Handlewaitpidreturning -1 (log errno, clearpin_out, close resources) before interpretingstatus.