From ab8b319c131692f34925d377eb0b304abc10bdc5 Mon Sep 17 00:00:00 2001 From: Robert Swiecki Date: Mon, 17 Feb 2020 14:07:25 +0100 Subject: [PATCH] subproc: verify that a pid in a pid map doesn't exist before inserting --- subproc.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/subproc.cc b/subproc.cc index d4373f8..730a586 100644 --- a/subproc.cc +++ b/subproc.cc @@ -215,6 +215,9 @@ static void addProc(nsjconf_t* nsjconf, pid_t pid, int sock) { snprintf(fname, sizeof(fname), "/proc/%d/syscall", (int)pid); p.pid_syscall_fd = TEMP_FAILURE_RETRY(open(fname, O_RDONLY | O_CLOEXEC)); + if (nsjconf->pids.find(pid) != nsjconf->pids.end()) { + LOG_F("pid=%d already exists", pid); + } nsjconf->pids.insert(std::make_pair(pid, p)); LOG_D("Added pid=%d with start time '%u' to the queue for IP: '%s'", pid, -- 2.34.1