Check rc and print error message if any.

It is probably good to use stdout before printing a generic error
message as well.