opnsense-ports/sysutils/lsof/files/patch-dialects_freebsd_dproc.c
Franco Fichtner 3f6f47fe08 */*: sync with upstream
Taken from: HardenedBSD
2021-02-01 17:29:40 +01:00

24 lines
790 B
C

--- dialects/freebsd/dproc.c.orig 2020-11-10 19:00:21 UTC
+++ dialects/freebsd/dproc.c
@@ -125,6 +125,9 @@ gather_proc_info()
* streams with eXPORT data,
* where supported */
struct filedesc fd;
+#if defined(PWDDESC_KVM_LOAD_PWD)
+ struct pwddesc pd;
+#endif /* defined(PWDDESC_KVM_LOAD_PWD) */
int i, nf;
MALLOC_S nb;
@@ -330,7 +333,11 @@ gather_proc_info()
#if defined(HAS_PWD)
cdir = rdir = jdir = NULL;
+#if defined(PWDDESC_KVM_LOAD_PWD)
+ pwd_addr = (KA_T)PWDDESC_KVM_LOAD_PWD(&pd);
+#else /* defined(PWDDESC_KVM_LOAD_PWD) */
pwd_addr = (KA_T)FILEDESC_KVM_LOAD_PWD(&fd);
+#endif /* defened(PWDDESC_KVM_LOAD_PWD) */
if (pwd_addr != 0) {
if (!kread(pwd_addr, (char *)&pwd, sizeof(pwd))) {
cdir = pwd.pwd_cdir;