]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: set O_NONBLOCK on file status flags
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 7 Sep 2018 21:25:43 +0000 (14:25 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 7 Jan 2019 20:41:20 +0000 (12:41 -0800)
There is no NONBLOCK file **descriptor** flag.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 7e91c8b5aa4548e15c01702f24aaf1f2fccf0468)

src/msg/simple/Accepter.cc

index db9e8795e6065497f8d1eedf9b1f1beb386d5843..16ea0413c2981398ced63bf45197a5dfc0bda88a 100644 (file)
@@ -60,9 +60,11 @@ int Accepter::create_selfpipe(int *pipe_rd, int *pipe_wr) {
 #else
   int ret = ::pipe(selfpipe);
   if (ret == 0) {
-    for (int i = 0; i < std::size(selfpipe); i++) {
-      int f = fcntl(selfpipe[i], F_GETFD);
-      fcntl(selfpipe[i], F_SETFD, f | FD_CLOEXEC | O_NONBLOCK);
+    for (size_t i = 0; i < std::size(selfpipe); i++) {
+      int f = fcntl(selfpipe[i], F_GETFL);
+      ceph_assert(f != -1);
+      f = fcntl(selfpipe[i], F_SETFL, f | O_NONBLOCK);
+      ceph_assert(f != -1);
     }
   }
 #endif