mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-17 06:41:55 +08:00
Fix SOCK_CLOEXEC with socket() and socketpair()
Remove SOCK_CLOEXEC flag to get a valid socket type, e.g. to avoid a EPROTOTYPE in case of socket(..., SOCK_DGRAM | SOCK_CLOEXEC, ...).
This commit is contained in:
parent
5f3722a8d9
commit
0732183638
@ -176,12 +176,10 @@ sys_socket(struct thread *td, struct socket_args *uap)
|
|||||||
type = uap->type;
|
type = uap->type;
|
||||||
oflag = 0;
|
oflag = 0;
|
||||||
fflag = 0;
|
fflag = 0;
|
||||||
#ifndef __rtems__
|
|
||||||
if ((type & SOCK_CLOEXEC) != 0) {
|
if ((type & SOCK_CLOEXEC) != 0) {
|
||||||
type &= ~SOCK_CLOEXEC;
|
type &= ~SOCK_CLOEXEC;
|
||||||
oflag |= O_CLOEXEC;
|
oflag |= O_CLOEXEC;
|
||||||
}
|
}
|
||||||
#endif /* __rtems__ */
|
|
||||||
if ((type & SOCK_NONBLOCK) != 0) {
|
if ((type & SOCK_NONBLOCK) != 0) {
|
||||||
type &= ~SOCK_NONBLOCK;
|
type &= ~SOCK_NONBLOCK;
|
||||||
fflag |= FNONBLOCK;
|
fflag |= FNONBLOCK;
|
||||||
@ -775,12 +773,10 @@ kern_socketpair(struct thread *td, int domain, int type, int protocol,
|
|||||||
|
|
||||||
oflag = 0;
|
oflag = 0;
|
||||||
fflag = 0;
|
fflag = 0;
|
||||||
#ifndef __rtems__
|
|
||||||
if ((type & SOCK_CLOEXEC) != 0) {
|
if ((type & SOCK_CLOEXEC) != 0) {
|
||||||
type &= ~SOCK_CLOEXEC;
|
type &= ~SOCK_CLOEXEC;
|
||||||
oflag |= O_CLOEXEC;
|
oflag |= O_CLOEXEC;
|
||||||
}
|
}
|
||||||
#endif /* __rtems__ */
|
|
||||||
if ((type & SOCK_NONBLOCK) != 0) {
|
if ((type & SOCK_NONBLOCK) != 0) {
|
||||||
type &= ~SOCK_NONBLOCK;
|
type &= ~SOCK_NONBLOCK;
|
||||||
fflag |= FNONBLOCK;
|
fflag |= FNONBLOCK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user