proc: fix freebsd proc argument.

This commit is contained in:
Alastair Poole 2020-05-08 22:14:01 +01:00
parent 8d1383e245
commit 3b82d992ac
1 changed files with 22 additions and 12 deletions

View File

@ -809,13 +809,18 @@ _process_list_freebsd_get(void)
{
if (args[0])
{
char *base = basename(args[0]);
if (base && base != args[0])
char *base = strdup(args[0]);
if (base)
{
snprintf(name, sizeof(name), "%s", base);
char *spc = strchr(name, ' ');
if (!spc)
have_command = EINA_TRUE;
char *spc = strchr(base, ' ');
if (spc) *spc = '\0';
if (ecore_file_exists(base))
{
snprintf(name, sizeof(name), "%s", basename(base));
have_command = EINA_TRUE;
}
free(base);
}
}
Eina_Strbuf *buf = eina_strbuf_new();
@ -867,13 +872,18 @@ _cmd_get(Proc_Info *p, struct kinfo_proc *kp)
{
if (args[0])
{
char *base = basename(args[0]);
if (base && base != args[0])
char *base = strdup(args[0]);
if (base)
{
snprintf(name, sizeof(name), "%s", base);
char *spc = strchr(name, ' ');
if (!spc)
have_command = EINA_TRUE;
char *spc = strchr(base, ' ');
if (spc) *spc = '\0';
if (ecore_file_exists(base))
{
snprintf(name, sizeof(name), "%s", basename(base));
have_command = EINA_TRUE;
}
free(base);
}
}
Eina_Strbuf *buf = eina_strbuf_new();