summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-03-02 08:49:50 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-03-02 08:49:50 -0500
commit6ac6111f5f3bc18360c5b80bf1ade95b2a06f2c8 (patch)
treefc9d66d3e303bfc3f724af2dd53424f097ac21a8 /src/lib
parentadded ipc-namespace profile command (diff)
downloadfirejail-6ac6111f5f3bc18360c5b80bf1ade95b2a06f2c8.tar.gz
firejail-6ac6111f5f3bc18360c5b80bf1ade95b2a06f2c8.tar.zst
firejail-6ac6111f5f3bc18360c5b80bf1ade95b2a06f2c8.zip
cleanup
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/common.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/common.c b/src/lib/common.c
index f321c5a47..fd3ab7071 100644
--- a/src/lib/common.c
+++ b/src/lib/common.c
@@ -84,10 +84,6 @@ int name2pid(const char *name, pid_t *pid) {
84 // check if this is a firejail executable 84 // check if this is a firejail executable
85 char *comm = pid_proc_comm(newpid); 85 char *comm = pid_proc_comm(newpid);
86 if (comm) { 86 if (comm) {
87 // remove \n
88 char *ptr = strchr(comm, '\n');
89 if (ptr)
90 *ptr = '\0';
91 if (strcmp(comm, "firejail")) { 87 if (strcmp(comm, "firejail")) {
92 free(comm); 88 free(comm);
93 continue; 89 continue;
@@ -150,6 +146,11 @@ char *pid_proc_comm(const pid_t pid) {
150 buffer[len] = '\0'; 146 buffer[len] = '\0';
151 close(fd); 147 close(fd);
152 148
149 // remove \n
150 char *ptr = strchr(buffer, '\n');
151 if (ptr)
152 *ptr = '\0';
153
153 // return a malloc copy of the command line 154 // return a malloc copy of the command line
154 char *rv = strdup((char *) buffer); 155 char *rv = strdup((char *) buffer);
155 if (strlen(rv) == 0) { 156 if (strlen(rv) == 0) {