"Put one statement conditionals on same line as condition: if (rc < 0) goto fail;"
This is bad advice. A source-level debugger only works in source line numbers; if you ever need to set a breakpoint to find out when an error condition occurs you need to be able to set it on the action statement "goto fail" and not be bothered by the breakpoint tripping every time the if() gets evaluated.
Always separate the conditional from the statement.