handleClose handles the close(2) syscall.
(n *seccomp.Notif, fd int)
| 250 | |
| 251 | // handleClose handles the close(2) syscall. |
| 252 | func (p *Process) handleClose(n *seccomp.Notif, fd int) error { |
| 253 | s, ok := p.getDeleteSocket(fd) |
| 254 | if !ok { |
| 255 | return n.Skip() |
| 256 | } |
| 257 | |
| 258 | if errno := s.Close(); errno != 0 { |
| 259 | // Failing to close a socket cleanly isn't a fatal error. Moreover, we need |
| 260 | // to let the kernel handle the syscall regardless of whether our close |
| 261 | // fails because the socket needs to be removed from the process' file |
| 262 | // descriptor table. |
| 263 | slog.Debug("failed to close socket cleanly", "errno", errno) |
| 264 | return n.Skip() |
| 265 | } |
| 266 | |
| 267 | // Allow the syscall to proceed so that the process can close its copy of the |
| 268 | // socket from its file descriptor table. |
| 269 | return n.Skip() |
| 270 | } |
| 271 | |
| 272 | // handleFcntl handles the fcntl(2) syscall. |
| 273 | func (p *Process) handleFcntl(n *seccomp.Notif, srcFD int, cmd int, arg int) error { |
no test coverage detected