{
int fd = (int)((long)thefd);
- return close(fd);
+ return close(fd) < 0 ? errno : APR_SUCCESS;
}
/* Read from the socket dealing with incomplete messages and signals.
static apr_status_t sock_write(int fd, const void *buf, size_t buf_size)
{
int rc;
+ const char *b = buf;
+ size_t written = 0;
do {
- rc = write(fd, buf, buf_size);
- } while (rc < 0 && errno == EINTR);
- if (rc < 0) {
- return errno;
- }
+ do {
+ rc = write(fd, b + written, buf_size - written);
+ } while (rc < 0 && errno == EINTR);
+ if (rc < 0) {
+ return errno;
+ }
+ written += rc;
+ } while (written < buf_size);
return APR_SUCCESS;
}
return DECLINED;
}
if (strlen(tmp_sockname) > sizeof(server_addr->sun_path) - 1) {
- tmp_sockname[sizeof(server_addr->sun_path)] = '\0';
+ tmp_sockname[sizeof(server_addr->sun_path) - 1] = '\0';
ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server, APLOGNO(01254)
"The length of the ScriptSock path exceeds maximum, "
"truncating to %s", tmp_sockname);