Use thread-local storage for ERR.

Change-Id: I012bff37094ecb29621197ea1d52626bb87f2f0f
4 files changed