runcmd: Improve error handling & memory management.

runcmd_cmd2strv():
Check for valid arguments, test for failed allocation, and
null-terminate the output argv array. Also avoid a potential leak if
returning early on unexpected end of string (really shouldn't ever
happen).

runcmd_open():
Check all arguments are non-null: __attribute__((__nonnull__(1, 2, 3, 5,
6))) is not a guarantee, it is still perfectly possible to pass NULL in
the specified positions and not pass "-Wnonnull" to gcc, or just ignore
the warning if it is generated. Handle failed allocation from
runcmd_cmd2strv(), consider commands with unbalanced quotes an error
(the shell does), and return the correct error code if pipe(pfd) fails.

test-runcmd:
Free our allocated memory. The only unfreed memory is now the pids array
internal to runcmd.c.