daemon_protect (Linux OOM protection function) is wrong

Description

The daemon_protect() function that's supposed to write a value to the /proc/<PID>/oom_score_adj file does this using "sizeof(oom_protect_new.oom_value[(int)action])-1" when what it should be using is "strlen(oom_protect_new.oom_value[(int)action])".
Since oom_protect_new.oom_value is of type "char *", sizeof(oom_protect_new.oom_value) is 8 and results in (for example) this call to write() seen via
strace:
write(4, "0\n\0-100", 7) = 7
instead of the desired
write(4, "0", 1)
(or
write(4, "0\n", 2)
depending on whether the newline is supposed to be included or not).

Acceptance Criteria

None

Status

Assignee

Vincent Stumpf

Reporter

Scott Campbell

Severity

None

OS

None

Start Date

None

Pull Request URL

None

Story Points

1

Components

Fix versions

Priority

Low
Configure