diff options
Diffstat (limited to 'src/lib/common.c')
-rw-r--r-- | src/lib/common.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lib/common.c b/src/lib/common.c index 2f2340963..add4ff087 100644 --- a/src/lib/common.c +++ b/src/lib/common.c | |||
@@ -39,22 +39,23 @@ int join_namespace(pid_t pid, char *type) { | |||
39 | errExit("asprintf"); | 39 | errExit("asprintf"); |
40 | 40 | ||
41 | int fd = open(path, O_RDONLY); | 41 | int fd = open(path, O_RDONLY); |
42 | if (fd < 0) { | 42 | if (fd < 0) |
43 | free(path); | 43 | goto errout; |
44 | fprintf(stderr, "Error: cannot open /proc/%u/ns/%s.\n", pid, type); | ||
45 | return -1; | ||
46 | } | ||
47 | 44 | ||
48 | if (syscall(__NR_setns, fd, 0) < 0) { | 45 | if (syscall(__NR_setns, fd, 0) < 0) { |
49 | free(path); | ||
50 | fprintf(stderr, "Error: cannot join namespace %s.\n", type); | ||
51 | close(fd); | 46 | close(fd); |
52 | return -1; | 47 | goto errout; |
53 | } | 48 | } |
54 | 49 | ||
55 | close(fd); | 50 | close(fd); |
56 | free(path); | 51 | free(path); |
57 | return 0; | 52 | return 0; |
53 | |||
54 | errout: | ||
55 | free(path); | ||
56 | fprintf(stderr, "Error: cannot join namespace %s\\n", type); | ||
57 | return -1; | ||
58 | |||
58 | } | 59 | } |
59 | 60 | ||
60 | // return 1 if error | 61 | // return 1 if error |
@@ -187,8 +188,6 @@ char *pid_proc_cmdline(const pid_t pid) { | |||
187 | for (i = 0; i < len; i++) { | 188 | for (i = 0; i < len; i++) { |
188 | if (buffer[i] == '\0') | 189 | if (buffer[i] == '\0') |
189 | buffer[i] = ' '; | 190 | buffer[i] = ' '; |
190 | // if (buffer[i] >= 0x80) // execv in progress!!! | ||
191 | // return NULL; | ||
192 | } | 191 | } |
193 | 192 | ||
194 | // return a malloc copy of the command line | 193 | // return a malloc copy of the command line |