Skip to content
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

Overload and non-parsed status processing is failing #9

Open
desertwitch opened this issue Oct 19, 2024 · 0 comments · May be fixed by #10
Open

Overload and non-parsed status processing is failing #9

desertwitch opened this issue Oct 19, 2024 · 0 comments · May be fixed by #10

Comments

@desertwitch
Copy link

desertwitch commented Oct 19, 2024

OVER and non-processed statuses never get evaluated as there is a bug in the LB status evaluation within this function:

wmnut/src/wmnut.c

Lines 136 to 150 in e3255f7

if (get_ups_var ("ups.status", value) > NOK) {
if (!strncmp(value, "OL", 2))
CurHost->ups_status = UPS_ONLINE;
else if (!strncmp(value, "OB", 2))
CurHost->ups_status = UPS_ONBATT;
else if (!strstr(value, "LB"))
CurHost->ups_status = UPS_LOWBATT;
else if (!strncmp(value, "OVER", 4))
CurHost->ups_status = UPS_OVERLOAD;
else
CurHost->ups_status = UPS_DEFAULT;
}
else
CurHost->ups_status = UPS_DEFAULT;

This else if checks if LB is not contained and sets the status to UPS_LOWBATT, but should check if it is contained here:

else if (!strstr(value, "LB"))

I'm overhauling this function as part of a larger pull request in the works (#8), so this issue is mostly a reminder to myself.

@desertwitch desertwitch linked a pull request Oct 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant