mirror of https://github.com/xzeldon/htop.git
FreeBSD: skip exe check for kernel thread
Kernel threads do not have an executable and the check can result in garbage values as unprivileged user.
This commit is contained in:
parent
fbe3a2155f
commit
af0b67ccd2
|
@ -380,16 +380,15 @@ static inline void FreeBSDProcessList_scanMemoryInfo(ProcessList* pl) {
|
|||
}
|
||||
|
||||
static void FreeBSDProcessList_updateExe(const struct kinfo_proc* kproc, Process* proc) {
|
||||
const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, kproc->ki_pid };
|
||||
char buffer[2048];
|
||||
size_t size = sizeof(buffer);
|
||||
if (sysctl(mib, 4, buffer, &size, NULL, 0) != 0) {
|
||||
if (Process_isKernelThread(proc)) {
|
||||
Process_updateExe(proc, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Kernel threads return an empty buffer */
|
||||
if (buffer[0] == '\0') {
|
||||
const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, kproc->ki_pid };
|
||||
char buffer[2048];
|
||||
size_t size = sizeof(buffer);
|
||||
if (sysctl(mib, 4, buffer, &size, NULL, 0) != 0) {
|
||||
Process_updateExe(proc, NULL);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue