Fix the use of incorrect options 95/302795/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 13 Dec 2023 22:17:30 +0000 (07:17 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 13 Dec 2023 22:21:26 +0000 (07:21 +0900)
The value that should be set for flags of the fcntl() is FD_CLOEXEC.
This patch modifies to use FD_CLOEXEC instead of O_CLOEXEC.

Change-Id: I443a54ba18098d1bd2f094cdb081ad6b54fbd02b
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/client-socket-internal.cc
src/server-socket-internal.cc

index 8ba4ffb..08b2ae9 100644 (file)
@@ -51,7 +51,7 @@ ClientSocket::~ClientSocket() {
 
 void ClientSocket::SetCloseOnExec() {
   int flags = fcntl(fd_, F_GETFL, 0);
-  fcntl(fd_, F_SETFL, flags | O_CLOEXEC);
+  fcntl(fd_, F_SETFL, flags | FD_CLOEXEC);
   _I("Close on exec. fd(%d)", fd_);
 }
 
index a5b1640..ed01137 100644 (file)
@@ -71,7 +71,7 @@ int ServerSocket::Listen(int backlog) {
 
 void ServerSocket::SetCloseOnExec() {
   int flags = fcntl(fd_, F_GETFL, 0);
-  fcntl(fd_, F_SETFL, flags | O_CLOEXEC);
+  fcntl(fd_, F_SETFL, flags | FD_CLOEXEC);
   _I("Close on exec. fd(%d)", fd_);
 }
 // LCOV_EXCL_STOP