diff options
author | 2018-10-09 08:40:02 -0400 | |
---|---|---|
committer | 2018-10-09 08:40:02 -0400 | |
commit | 674b69978827a25e76f974c99f7b5aafe2e68c13 (patch) | |
tree | f684164f89bbce211a470ae7ca64f3a4843f7b65 /src/lib | |
parent | mainline merge: configure.ac: set sysconfdir only if none was specified manually (diff) | |
download | firejail-674b69978827a25e76f974c99f7b5aafe2e68c13.tar.gz firejail-674b69978827a25e76f974c99f7b5aafe2e68c13.tar.zst firejail-674b69978827a25e76f974c99f7b5aafe2e68c13.zip |
mainline merge: Firejail should look for processes with names exactly named
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/pid.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/pid.c b/src/lib/pid.c index 75576c787..ee1550e57 100644 --- a/src/lib/pid.c +++ b/src/lib/pid.c | |||
@@ -359,7 +359,10 @@ void pid_read(pid_t mon_pid) { | |||
359 | char buf[PIDS_BUFLEN]; | 359 | char buf[PIDS_BUFLEN]; |
360 | while (fgets(buf, PIDS_BUFLEN - 1, fp)) { | 360 | while (fgets(buf, PIDS_BUFLEN - 1, fp)) { |
361 | if (strncmp(buf, "Name:", 5) == 0) { | 361 | if (strncmp(buf, "Name:", 5) == 0) { |
362 | char *ptr = buf + 5; | 362 | char *ptr = strchr(buf, '\n'); |
363 | if (ptr) | ||
364 | *ptr = '\0'; | ||
365 | ptr = buf + 5; | ||
363 | while (*ptr != '\0' && (*ptr == ' ' || *ptr == '\t')) { | 366 | while (*ptr != '\0' && (*ptr == ' ' || *ptr == '\t')) { |
364 | ptr++; | 367 | ptr++; |
365 | } | 368 | } |
@@ -368,7 +371,7 @@ void pid_read(pid_t mon_pid) { | |||
368 | exit(1); | 371 | exit(1); |
369 | } | 372 | } |
370 | 373 | ||
371 | if ((strncmp(ptr, "firejail", 8) == 0) && (mon_pid == 0 || mon_pid == pid)) { | 374 | if ((strcmp(ptr, "firejail") == 0) && (mon_pid == 0 || mon_pid == pid)) { |
372 | if (pid_proc_cmdline_x11_xpra_xephyr(pid)) | 375 | if (pid_proc_cmdline_x11_xpra_xephyr(pid)) |
373 | pids[pid].level = -1; | 376 | pids[pid].level = -1; |
374 | else | 377 | else |