lib/replace: Make sure that replacement strto[u]ll does not reset errno unexpectedly