| 1204 | } |
| 1205 | |
| 1206 | int |
| 1207 | kern_shutdown(struct thread *td, int s, int how) |
| 1208 | { |
| 1209 | struct socket *so; |
| 1210 | struct file *fp; |
| 1211 | int error; |
| 1212 | |
| 1213 | AUDIT_ARG_FD(s); |
| 1214 | error = getsock_cap(td, s, &cap_shutdown_rights, |
| 1215 | &fp, NULL, NULL); |
| 1216 | if (error == 0) { |
| 1217 | so = fp->f_data; |
| 1218 | error = soshutdown(so, how); |
| 1219 | /* |
| 1220 | * Previous versions did not return ENOTCONN, but 0 in |
| 1221 | * case the socket was not connected. Some important |
| 1222 | * programs like syslogd up to r279016, 2015-02-19, |
| 1223 | * still depend on this behavior. |
| 1224 | */ |
| 1225 | if (error == ENOTCONN && |
| 1226 | td->td_proc->p_osrel < P_OSREL_SHUTDOWN_ENOTCONN) |
| 1227 | error = 0; |
| 1228 | fdrop(fp, td); |
| 1229 | } |
| 1230 | return (error); |
| 1231 | } |
| 1232 | |
| 1233 | int |
| 1234 | sys_setsockopt(struct thread *td, struct setsockopt_args *uap) |
no test coverage detected