From d8f743dcaa8ae633a369e55482eae74833b138fc Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 28 Feb 2020 17:05:27 +0000 Subject: [PATCH] Do not load dtraceall.ko if dtrace.ko is already loaded. This was the intent of the existing code, but instead it would unconditionally load dtraceall.ko because of a stale errno value. Reported by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c index 492fb937cba2..482da920b754 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -1105,7 +1105,7 @@ dt_vopen(int version, int flags, int *errp, dt_provmod_open(&provmod, &df); dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC); - err = errno; /* save errno from opening dtfd */ + err = dtfd == -1 ? errno : 0; /* save errno from opening dtfd */ #if defined(__FreeBSD__) /* * Automatically load the 'dtraceall' module if we couldn't open the