process: Fix Linux Process Arguments.

Arguments are NULL terminated until we hit padded NULLs.
This commit is contained in:
Alastair Poole 2020-05-09 00:00:56 +01:00
parent 27053fa460
commit fc60c351ca
1 changed files with 11 additions and 1 deletions

View File

@ -184,9 +184,19 @@ _cmd_args(Proc_Info *p, int pid, char *name, size_t len)
{ {
if (fgets(line, sizeof(line), f)) if (fgets(line, sizeof(line), f))
{ {
Eina_Strbuf *buf = eina_strbuf_new();
const char *n;
if (ecore_file_exists(line)) if (ecore_file_exists(line))
snprintf(name, len, "%s", ecore_file_file_get(line)); snprintf(name, len, "%s", ecore_file_file_get(line));
p->arguments = strdup(line);
n = line;
while (*n && (*n + 1))
{
eina_strbuf_append_printf(buf, "%s ", n);
n = strchr(n, '\0') + 1;
}
p->arguments = eina_strbuf_release(buf);
} }
fclose(f); fclose(f);
} }