Lines 90-95
rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid)
Link Here
|
90 |
{ |
90 |
{ |
91 |
DIR *procdir; |
91 |
DIR *procdir; |
92 |
struct dirent *entry; |
92 |
struct dirent *entry; |
|
|
93 |
FILE *fp; |
94 |
bool host_process = true; |
95 |
char *line = NULL; |
96 |
size_t len = 0; |
93 |
pid_t p; |
97 |
pid_t p; |
94 |
char buffer[PATH_MAX]; |
98 |
char buffer[PATH_MAX]; |
95 |
struct stat sb; |
99 |
struct stat sb; |
Lines 134-139
rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid)
Link Here
|
134 |
if (argv && |
138 |
if (argv && |
135 |
!pid_is_argv(p, (const char *const *)argv)) |
139 |
!pid_is_argv(p, (const char *const *)argv)) |
136 |
continue; |
140 |
continue; |
|
|
141 |
snprintf(buffer, sizeof(buffer), "/proc/%d/status", p); |
142 |
if (exists(buffer)) { |
143 |
fp = fopen(buffer, "r"); |
144 |
if (! fp) |
145 |
continue; |
146 |
while (! feof(fp) && host_process) { |
147 |
rc_getline(fp, &line, &len); |
148 |
if (strncmp(line, "envID:", 6) == 0) |
149 |
host_process = (strncmp(line, "envID: 0", 8) == 0); |
150 |
} |
151 |
free(line); |
152 |
fclose(fp); |
153 |
} |
154 |
if (! host_process) |
155 |
continue; |
137 |
if (!pids) { |
156 |
if (!pids) { |
138 |
pids = xmalloc(sizeof(*pids)); |
157 |
pids = xmalloc(sizeof(*pids)); |
139 |
LIST_INIT(pids); |
158 |
LIST_INIT(pids); |