POSIX: add missing curly braces

It seems that the original commit missed the curly braces for the scope, always
doing the string comparision.
POSIX: fix possible invalid API usage

strcmp cannot be passed a NULL.  Add a short-circuiting check to avoid the
possible API misuse.
POSIX: fix possible API misuse

memcpy cannot be passed NULL.  Ensuring that the destination pointer is non-NULL
requires checking success.  Rather than performing the success check at that
point, increasing indentation an additional level, fold it into the previous
statement.