subproc: verify that a pid in a pid map doesn't exist before inserting

This commit is contained in:
Robert Swiecki
2020-02-17 14:07:25 +01:00
parent 2cf562160d
commit ab8b319c13

View File

@@ -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,