aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/common.c
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2018-08-19 14:07:10 +0200
committerLibravatar smitsohu <smitsohu@gmail.com>2018-08-19 14:07:10 +0200
commitb57caa22e5a5d1ce2fbb7cb1bca46c26e1f47540 (patch)
tree93272823ee2ea8e0b5bcb142115db91f45f56511 /src/lib/common.c
parenttests: increase some timeouts in which I was running (diff)
downloadfirejail-b57caa22e5a5d1ce2fbb7cb1bca46c26e1f47540.tar.gz
firejail-b57caa22e5a5d1ce2fbb7cb1bca46c26e1f47540.tar.zst
firejail-b57caa22e5a5d1ce2fbb7cb1bca46c26e1f47540.zip
fix issue with join option
Diffstat (limited to 'src/lib/common.c')
-rw-r--r--src/lib/common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/common.c b/src/lib/common.c
index fa988446b..d6dd43c4b 100644
--- a/src/lib/common.c
+++ b/src/lib/common.c
@@ -129,7 +129,7 @@ char *pid_proc_comm(const pid_t pid) {
129 // open /proc/pid/cmdline file 129 // open /proc/pid/cmdline file
130 char *fname; 130 char *fname;
131 int fd; 131 int fd;
132 if (asprintf(&fname, "/proc/%d//comm", pid) == -1) 132 if (asprintf(&fname, "/proc/%d/comm", pid) == -1)
133 return NULL; 133 return NULL;
134 if ((fd = open(fname, O_RDONLY)) < 0) { 134 if ((fd = open(fname, O_RDONLY)) < 0) {
135 free(fname); 135 free(fname);
@@ -154,6 +154,8 @@ char *pid_proc_comm(const pid_t pid) {
154 154
155 // return a malloc copy of the command line 155 // return a malloc copy of the command line
156 char *rv = strdup(buffer); 156 char *rv = strdup(buffer);
157 if (!rv)
158 return NULL;
157 if (strlen(rv) == 0) { 159 if (strlen(rv) == 0) {
158 free(rv); 160 free(rv);
159 return NULL; 161 return NULL;
@@ -192,6 +194,8 @@ char *pid_proc_cmdline(const pid_t pid) {
192 194
193 // return a malloc copy of the command line 195 // return a malloc copy of the command line
194 char *rv = strdup((char *) buffer); 196 char *rv = strdup((char *) buffer);
197 if (!rv)
198 return NULL;
195 if (strlen(rv) == 0) { 199 if (strlen(rv) == 0) {
196 free(rv); 200 free(rv);
197 return NULL; 201 return NULL;