Skip to content

Commit

Permalink
Revert "Get full path on FreeBSD"
Browse files Browse the repository at this point in the history
KERN_PROC_ARGS fails on FreeBSD is file doesn't exist

This reverts commit dfa821d.
  • Loading branch information
ricardobranco777 committed May 30, 2024
1 parent dfa821d commit 8285241
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bsd/kinfo_getargv.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@

static char *kinfo_getpathname(pid_t);

#if !defined(__FreeBSD__)
static char *xbasename(char *s);

static char *
xbasename(char *s) {
char *t = strrchr(s, '/');
return (t == NULL ? (char *)s : ++t);
}
#endif

static char *
kinfo_getpathname(pid_t pid)
Expand Down Expand Up @@ -96,6 +98,7 @@ kinfo_getargv(pid_t pid)
if (argv == NULL)
goto bad;

#if !defined(__FreeBSD__)
if (buf[0] != '/') {
argv[0] = kinfo_getpathname(pid);
if (argv[0] != NULL) {
Expand All @@ -106,6 +109,7 @@ kinfo_getargv(pid_t pid)
free(argv[0]);
}
}
#endif

for (; i < argc; i++) {
argv[i] = strdup(buf + off);
Expand Down

0 comments on commit 8285241

Please sign in to comment.