diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2011-04-23 13:15:56 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2011-04-23 13:15:56 +0000 |
| commit | 1143d00a160d919c3bd32481c565173bfd153402 (patch) | |
| tree | 77da8b54c275c105ccc17b8984e3413d99bfd0c1 | |
| parent | c37192b537bf99e385ce488d7c9b985ae5d130b5 (diff) | |
| download | nginx-1143d00a160d919c3bd32481c565173bfd153402.tar.gz nginx-1143d00a160d919c3bd32481c565173bfd153402.tar.bz2 | |
fix r3822
Solaris strerror() invalid error code behaviour depends on version:
Solaris 10 returns "Unknown error" and sets errno to EINVAL,
Solaris 9 returns "Unknown error" and leaves errno intact,
Solaris 2 returns NULL.
| -rwxr-xr-x | auto/unix | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -141,14 +141,19 @@ if [ $ngx_found = no ]; then ngx_feature_name=NGX_SYS_NERR ngx_feature_run=value ngx_feature_incs='#include <errno.h> + #include <string.h>' #include <stdio.h>' ngx_feature_path= ngx_feature_libs= ngx_feature_test='int n; + char *p; for (n = 1; n < 1000; n++) { errno = 0; - strerror(n); - if (errno == EINVAL) { + p = strerror(n); + if (errno == EINVAL + || p == NULL + || strncmp(p, "Unknown error", 13) == 0) + { printf("%d", n); return 0; } |
