correct O_CLOEXEC to FD_CLOEXEC for F_SETFL

replication_quorum
YuQing 2022-06-25 09:22:25 +08:00
parent e254b8e1d3
commit 4a7d852409
2 changed files with 2 additions and 2 deletions

View File

@ -730,7 +730,7 @@ int fd_add_flags(int fd, int adding_flags);
* fd: the fd to set
* return: error no , 0 success, != 0 fail
*/
#define set_nonblock(fd) fd_add_flags(fd, O_NONBLOCK)
#define set_nonblock(fd) fd_add_flags(fd, O_NONBLOCK | FD_CLOEXEC)
/** set fd FD_CLOEXEC flags
* parameters:

View File

@ -2126,7 +2126,7 @@ int tcpsetnonblockopt(int fd)
return errno != 0 ? errno : EACCES;
}
if (fcntl(fd, F_SETFL, flags | (O_NONBLOCK | O_CLOEXEC)) < 0)
if (fcntl(fd, F_SETFL, flags | (O_NONBLOCK | FD_CLOEXEC)) < 0)
{
logError("file: "__FILE__", line: %d, " \
"fcntl failed, errno: %d, error info: %s.", \