| 132 |
log_error("epoll_ctl(STDOUT_FILENO) error (%d)\n", errno); |
log_error("epoll_ctl(STDOUT_FILENO) error (%d)\n", errno); |
| 133 |
if (close(stdout_epollfd) < 0) |
if (close(stdout_epollfd) < 0) |
| 134 |
{ |
{ |
| 135 |
log_error("close(stdout_epollfd) error (%d)\n"); |
log_error("close(stdout_epollfd) error (%d)\n", errno); |
| 136 |
} |
} |
| 137 |
stdout_epollfd = -1; |
stdout_epollfd = -1; |
| 138 |
return -1; |
return -1; |
| 214 |
|
|
| 215 |
if (close(stdout_epollfd) < 0) |
if (close(stdout_epollfd) < 0) |
| 216 |
{ |
{ |
| 217 |
log_error("close(stdout_epollfd) error (%d)\n"); |
log_error("close(stdout_epollfd) error (%d)\n", errno); |
| 218 |
} |
} |
| 219 |
stdout_epollfd = -1; |
stdout_epollfd = -1; |
| 220 |
} |
} |
| 262 |
errno = EAGAIN; |
errno = EAGAIN; |
| 263 |
int need = stdout_buf_len + ret - OUTPUT_BUF_SIZE; |
int need = stdout_buf_len + ret - OUTPUT_BUF_SIZE; |
| 264 |
log_error("Output buffer is full, additional %d is required\n", need); |
log_error("Output buffer is full, additional %d is required\n", need); |
| 265 |
|
ret = -1; |
| 266 |
} |
} |
| 267 |
} |
} |
| 268 |
|
|
| 1167 |
{ |
{ |
| 1168 |
if (errno == EINVAL) // Incomplete |
if (errno == EINVAL) // Incomplete |
| 1169 |
{ |
{ |
| 1170 |
log_debug("iconv(inbytes=%ld, outbytes=%ld) error: EINVAL, in_buf[0]=%d\n", in_bytes, out_bytes, in_buf[0]); |
log_debug("iconv(inbytes=%zu, outbytes=%zu) error: EINVAL, in_buf[0]=%d\n", |
| 1171 |
|
in_bytes, out_bytes, (unsigned char)in_buf[0]); |
| 1172 |
if (p_buf != in_buf) |
if (p_buf != in_buf) |
| 1173 |
{ |
{ |
| 1174 |
*p_buf_len -= (int)(in_buf - p_buf); |
*p_buf_len -= (int)(in_buf - p_buf); |
| 1181 |
} |
} |
| 1182 |
else if (errno == E2BIG) |
else if (errno == E2BIG) |
| 1183 |
{ |
{ |
| 1184 |
log_error("iconv(inbytes=%ld, outbytes=%ld) error: E2BIG\n", in_bytes, out_bytes); |
log_error("iconv(inbytes=%zu, outbytes=%zu) error: E2BIG\n", in_bytes, out_bytes); |
| 1185 |
return -1; |
return -1; |
| 1186 |
} |
} |
| 1187 |
else if (errno == EILSEQ) |
else if (errno == EILSEQ) |
| 1188 |
{ |
{ |
| 1189 |
if (in_bytes > out_bytes || out_bytes <= 0) |
if (in_bytes > out_bytes || out_bytes <= 0) |
| 1190 |
{ |
{ |
| 1191 |
log_error("iconv(inbytes=%ld, outbytes=%ld) error: EILSEQ and E2BIG\n", in_bytes, out_bytes); |
log_error("iconv(inbytes=%zu, outbytes=%zu) error: EILSEQ\n", in_bytes, out_bytes); |
| 1192 |
return -2; |
return -2; |
| 1193 |
} |
} |
| 1194 |
|
|
| 1196 |
if (in_bytes == 0) |
if (in_bytes == 0) |
| 1197 |
{ |
{ |
| 1198 |
in_bytes = (size_t)(*p_buf_len - *p_buf_offset); |
in_bytes = (size_t)(*p_buf_len - *p_buf_offset); |
| 1199 |
log_debug("Reset in_bytes from 0 to %ld\n", in_bytes); |
log_debug("Reset in_bytes from 0 to %zu\n", in_bytes); |
| 1200 |
} |
} |
| 1201 |
|
|
| 1202 |
log_debug("iconv(in_bytes=%ld, out_bytes=%ld) error: EILSEQ, in_buf[0]=%d\n", |
log_debug("iconv(in_bytes=%zu, out_bytes=%zu) error: EILSEQ, in_buf[0]=%d\n", |
| 1203 |
in_bytes, out_bytes, in_buf[0]); |
in_bytes, out_bytes, (unsigned char)in_buf[0]); |
| 1204 |
skip_current = 1; |
skip_current = 1; |
| 1205 |
} |
} |
| 1206 |
else // something strange |
else // something strange |
| 1207 |
{ |
{ |
| 1208 |
log_debug("iconv(in_bytes=%ld, out_bytes=%ld) error: %d, in_buf[0]=%d\n", |
log_debug("iconv(in_bytes=%zu, out_bytes=%zu) error: %d, in_buf[0]=%d\n", |
| 1209 |
in_bytes, out_bytes, errno, in_buf[0]); |
in_bytes, out_bytes, errno, (unsigned char)in_buf[0]); |
| 1210 |
*p_buf_offset = (int)(in_buf - p_buf); |
*p_buf_offset = (int)(in_buf - p_buf); |
| 1211 |
*p_conv_len = (int)(conv_size - out_bytes); |
*p_conv_len = (int)(conv_size - out_bytes); |
| 1212 |
skip_current = 1; |
skip_current = 1; |