| 126 | } |
| 127 | |
| 128 | int close(int fd) |
| 129 | { |
| 130 | char peer[64], *at, buf[256]; |
| 131 | |
| 132 | if (fd < 0) { |
| 133 | acl_msg_error("%s(%d), %s: invalid fd: %d", |
| 134 | __FILE__, __LINE__, __FUNCTION__, fd); |
| 135 | trace_info("invalid fd"); |
| 136 | return -1; |
| 137 | } |
| 138 | |
| 139 | if (__monitor_ports_cur == 0 |
| 140 | || acl_getpeername(fd, peer, sizeof(peer)) == -1) |
| 141 | { |
| 142 | peer[0] = 0; |
| 143 | } else if ((at = strchr(peer, ':')) && *++at && should_check(atoi(at))) { |
| 144 | snprintf(buf, sizeof(buf), "closing %s", peer); |
| 145 | trace_info(buf); |
| 146 | } |
| 147 | |
| 148 | if (__sys_close(fd) == 0) |
| 149 | return 0; |
| 150 | |
| 151 | snprintf(buf, sizeof(buf), "close error %s, fd=%d, peer=%s", |
| 152 | acl_last_serror(), fd, peer); |
| 153 | trace_info(buf); |
| 154 | |
| 155 | return -1; |
| 156 | } |
no test coverage detected
searching dependent graphs…