Skip to content

Commit 731a9b7

Browse files
committed
fix mixup of O_CLOEXEC with FD_CLOEXEC
1 parent 19e0340 commit 731a9b7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • src/third-party/notcurses/src/compat

src/third-party/notcurses/src/compat/compat.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,18 @@ int set_fd_cloexec(int fd, unsigned state, unsigned* oldstate){
125125
return -1;
126126
}
127127
if(oldstate){
128-
*oldstate = flags & O_CLOEXEC;
128+
*oldstate = flags & FD_CLOEXEC;
129129
}
130130
if(state){
131-
if(flags & O_CLOEXEC){
131+
if(flags & FD_CLOEXEC){
132132
return 0;
133133
}
134-
flags |= O_CLOEXEC;
134+
flags |= FD_CLOEXEC;
135135
}else{
136-
if(!(flags & O_CLOEXEC)){
136+
if(!(flags & FD_CLOEXEC)){
137137
return 0;
138138
}
139-
flags &= ~O_CLOEXEC;
139+
flags &= ~FD_CLOEXEC;
140140
}
141141
if(fcntl(fd, F_SETFD, flags)){
142142
return -1;

0 commit comments

Comments
 (0)