How about allocating buffer and to check ERANGE code, this method described stackoverflow.

(note): 
 - `char* strerror_p()` is the GNU specific version, so non-glibc environment such as OS X cannot (OS X is experimental support in jubatus developer team, so you don't have to care non-Linux compatibility thoroughly) 
 - glibc of RHEL 6.2 looks v2.12

http://man7.org/linux/man-pages/man3/strerror.3.html