]> git.apps.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>
Thu, 20 Sep 2018 15:06:08 +0000 (08:06 -0700)
There is no NONBLOCK file **descriptor** flag.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/msg/simple/Accepter.cc

index dc5fe189dd26165bfaddfba1b2bf37d27efd855c..b2712f8f6216a3300dee82b2c3a11d83dcc001aa 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