Fixed errno being corrupted by LOG_ERROR()