Skip to content

Commit 1137e8d

Browse files
committed
Processing (Haiku): fix exe detection
1 parent 95a44d3 commit 1137e8d

File tree

1 file changed

+8
-30
lines changed

1 file changed

+8
-30
lines changed

src/common/processing_linux.c

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -315,39 +315,17 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
315315

316316
#elif defined(__HAIKU__)
317317

318-
{
319-
team_info info;
320-
if (get_team_info(pid, &info) == B_OK)
321-
{
322-
// This is tricky. Paths in info.args are not quoted, so that we don't know
323-
// if a whitespace in args is part of the file path or an argument separator
324-
if (info.argc == 1)
325-
ffStrbufSetS(exe, info.args);
326-
else
327-
{
328-
// args = "/bin/bash -l"
329-
// argc = 2
330-
int argc = info.argc - 1;
331-
const char* arg0End = strchr(info.args, ' ');
332-
for (const char* p = arg0End + 1; (p = strchr(p, ' ')); ++p)
333-
--argc;
334-
if (argc == 1) // No whitespace in the file path
335-
ffStrbufSetNS(exe, (uint32_t) (arg0End - info.args), info.args);
336-
}
337-
}
338-
}
318+
image_info info;
319+
int32 cookie = 0;
339320

340-
if (exePath)
321+
while (get_next_image_info(pid, &cookie, &info) == B_OK)
341322
{
342-
image_info info;
343-
int32 cookie = 0;
323+
if (info.type != B_APP_IMAGE) continue;
324+
ffStrbufSetS(exe, info.name);
344325

345-
while (get_next_image_info(pid, &cookie, &info) == B_OK)
346-
{
347-
if (info.type != B_APP_IMAGE) continue;
348-
ffStrbufSetS(exePath, info.name);
349-
break;
350-
}
326+
if (exePath)
327+
ffStrbufSet(exePath, exe);
328+
break;
351329
}
352330

353331
#endif

0 commit comments

Comments
 (0)