seccomp_unotify.2: EXAMPLES: fix a file descriptor leak

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-10-30 16:31:11 +01:00
parent 8760bd15a1
commit f8899e1c88
1 changed files with 2 additions and 3 deletions

View File

@ -1464,7 +1464,7 @@ getTargetPathname(struct seccomp_notif *req, int notifyFd,
then read() on that file descriptor will return 0 (EOF). */
if (!cookieIsValid(notifyFd, req\->id)) {
perror("\etS: notification ID check failed!!!");
close(procMemFd);
return false;
}
@ -1480,8 +1480,7 @@ getTargetPathname(struct seccomp_notif *req, int notifyFd,
exit(EXIT_FAILURE);
}
if (close(procMemFd) == \-1)
errExit("Supervisor: close\-/proc/PID/mem");
close(procMemFd);
/* Once again check that the notification ID is still valid. The
case we are particularly concerned about here is that just