GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Native transports: Correctly create pipe when pipe2 is not supported … · netty/netty@1b9e868

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • transport-native-unix-common/src/main/c
    • netty_unix_filedescriptor.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎transport-native-unix-common/src/main/c/netty_unix_filedescriptor.c‎

Copy file name to clipboardExpand all lines: transport-native-unix-common/src/main/c/netty_unix_filedescriptor.c
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,16 @@ static jlong netty_unix_filedescriptor_newPipe(JNIEnv* env, jclass clazz) {
244244
}
245245
} else {
246246
if (pipe(fd) == 0) {
247-
if (fcntl(fd[0], F_SETFD, O_NONBLOCK) < 0) {
247+
// Read current flags and OR-ing in O_NONBLOCK to preserve old flags as well.
248+
int flags0 = fcntl(fd[0], F_GETFL, 0);
249+
if (flags0 < 0 || fcntl(fd[0], F_SETFL, flags0 | O_NONBLOCK) < 0) {
248250
int err = errno;
249251
close(fd[0]);
250252
close(fd[1]);
251253
return -err;
252254
}
253-
if (fcntl(fd[1], F_SETFD, O_NONBLOCK) < 0) {
255+
int flags1 = fcntl(fd[1], F_GETFL, 0);
256+
if (flags1 < 0 || fcntl(fd[1], F_SETFL, flags1 | O_NONBLOCK) < 0) {
254257
int err = errno;
255258
close(fd[0]);
256259
close(fd[1]);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.