diff --git a/bsd/kinfo_getargv.c b/bsd/kinfo_getargv.c index 88fc7a1..5861da9 100644 --- a/bsd/kinfo_getargv.c +++ b/bsd/kinfo_getargv.c @@ -89,10 +89,11 @@ kinfo_getargv(pid_t pid) goto bad; if (buf[0] != '/') { - argv[i++] = kinfo_getpathname(pid); - if (argv[0] == NULL) - goto bad; - off += strlen(buf) + 1; + argv[0] = kinfo_getpathname(pid); + if (argv[0] != NULL) { + off += strlen(buf) + 1; + i++; + } } for (; i < argc; i++) {