Mercurial > hg > nginx-quic
view src/os/unix/ngx_errno.c @ 330:377a955421dc
nginx-0.0.3-2004-04-29-20:34:26 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 29 Apr 2004 16:34:26 +0000 |
parents | 4b1a3a4acc60 |
children | da8c5707af39 |
line wrap: on
line source
#include <ngx_config.h> #include <ngx_core.h> #if (HAVE_STRERROR_R) ngx_int_t ngx_strerror_r(int err, char *errstr, size_t size) { size_t len; if (size == 0) { return 0; } errstr[0] = '\0'; strerror_r(err, errstr, size); for (len = 0; len < size; len++) { if (errstr[len] == '\0') { break; } } return len; } #elif (HAVE_GNU_STRERROR_R) /* Linux strerror_r() */ ngx_int_t ngx_strerror_r(int err, char *errstr, size_t size) { char *str; size_t len; if (size == 0) { return 0; } errstr[0] = '\0'; str = strerror_r(err, errstr, size); if (str != errstr) { return ngx_cpystrn(errstr, str, size) - (u_char *) errstr; } for (len = 0; len < size; len++) { if (errstr[len] == '\0') { break; } } return len; } #endif