FreeBSD Bugzilla – Attachment 156148 Details for
Bug 199810
libdtrace should probably use O_CLOEXEC while calling open() instead of setting FD_CLOEXEC using fcntl()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A patch to add the appropriate O_CLOEXEC flags and to remove the fcntl() calls
libdtrace-O_CLOEXEC.patch (text/plain), 1.61 KB, created by
jau
on 2015-04-30 13:34:08 UTC
(
hide
)
Description:
A patch to add the appropriate O_CLOEXEC flags and to remove the fcntl() calls
Filename:
MIME Type:
Creator:
jau
Created:
2015-04-30 13:34:08 UTC
Size:
1.61 KB
patch
obsolete
>Index: cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c >=================================================================== >--- cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c (revision 282268) >+++ cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c (working copy) >@@ -962,7 +962,7 @@ > > (void) snprintf(path, sizeof (path), "/dev/dtrace/%s", p1); > >- if ((fd = open(path, O_RDONLY)) == -1) >+ if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) > continue; /* failed to open driver; just skip it */ > > if (((prov = malloc(sizeof (dt_provmod_t))) == NULL) || >@@ -1099,7 +1099,7 @@ > */ > dt_provmod_open(&provmod, &df); > >- dtfd = open("/dev/dtrace/dtrace", O_RDWR); >+ dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC); > err = errno; /* save errno from opening dtfd */ > #if defined(__FreeBSD__) > /* >@@ -1108,7 +1108,7 @@ > */ > if (err == ENOENT && modfind("dtraceall") < 0) { > kldload("dtraceall"); /* ignore the error */ >- dtfd = open("/dev/dtrace/dtrace", O_RDWR); >+ dtfd = open("/dev/dtrace/dtrace", O_RDWR | O_CLOEXEC); > err = errno; > } > #endif >@@ -1115,7 +1115,7 @@ > #ifdef illumos > ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR); > #else >- ftfd = open("/dev/dtrace/fasttrap", O_RDWR); >+ ftfd = open("/dev/dtrace/fasttrap", O_RDWR | O_CLOEXEC); > #endif > fterr = ftfd == -1 ? errno : 0; /* save errno from open ftfd */ > >@@ -1145,9 +1145,6 @@ > return (set_open_errno(dtp, errp, err)); > } > >- (void) fcntl(dtfd, F_SETFD, FD_CLOEXEC); >- (void) fcntl(ftfd, F_SETFD, FD_CLOEXEC); >- > alloc: > if ((dtp = malloc(sizeof (dtrace_hdl_t))) == NULL) > return (set_open_errno(dtp, errp, EDT_NOMEM));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 199810
: 156148