Reset the errno before relying on it in strtol.

See also: http://codereview.appspot.com/143090043/