comparison auto/unix @ 3901:c8b9f58c392b

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.
author Igor Sysoev <igor@sysoev.ru>
date Sat, 23 Apr 2011 13:15:56 +0000
parents 573cd56f006b
children 8258eb4c9d25
comparison
equal deleted inserted replaced
3900:4d5754e2f220 3901:c8b9f58c392b
139 # Solaris has no sys_nerr 139 # Solaris has no sys_nerr
140 ngx_feature='maximum errno' 140 ngx_feature='maximum errno'
141 ngx_feature_name=NGX_SYS_NERR 141 ngx_feature_name=NGX_SYS_NERR
142 ngx_feature_run=value 142 ngx_feature_run=value
143 ngx_feature_incs='#include <errno.h> 143 ngx_feature_incs='#include <errno.h>
144 #include <string.h>'
144 #include <stdio.h>' 145 #include <stdio.h>'
145 ngx_feature_path= 146 ngx_feature_path=
146 ngx_feature_libs= 147 ngx_feature_libs=
147 ngx_feature_test='int n; 148 ngx_feature_test='int n;
149 char *p;
148 for (n = 1; n < 1000; n++) { 150 for (n = 1; n < 1000; n++) {
149 errno = 0; 151 errno = 0;
150 strerror(n); 152 p = strerror(n);
151 if (errno == EINVAL) { 153 if (errno == EINVAL
154 || p == NULL
155 || strncmp(p, "Unknown error", 13) == 0)
156 {
152 printf("%d", n); 157 printf("%d", n);
153 return 0; 158 return 0;
154 } 159 }
155 }' 160 }'
156 . auto/feature 161 . auto/feature