replace strerr*() functions with %m format for thread-safety