fence_lpar: Fix parse error from long command line
When Pacemaker executes fence_lpar and the HMC command line is greater
than 80 characters, a parse error causes agent failure. This can happen
with a long user name and/or long managed system name. It happens only
when Pacemaker spawns the fence_lpar process; it does not happen when
fence_lpar is run from the CLI.
A long command line gets a carriage return ('\r') added at the 80
character mark and wraps back to the beginning of the line with no line
feed ('\n'), overwriting the displayed characters. fence_lpar's regex
matches handle this fine when it's run from the command line.
The problem is that when Pacemaker spawns fence_lpar, for some
reason there are backspace characters in the buffer when we hit the
'\r' character. This seems to overwrite some of the conn.before
string. As a result, the regex doesn't match conn.before, and the
agent fails.
This patch works around the conn.before weirdness by reading and
discarding the first received line before any regex processing.
Resolves: RHBZ#1860544
Resolves: RHBZ#1860545
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>