Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
5198b513
Unverified
Commit
5198b513
authored
Jan 19, 2021
by
Andy Pan
Committed by
GitHub
Jan 19, 2021
Browse files
Add a precheck before the actual call to fcntl (#8360)
Don't bother to call fcntl if the flags are not gonna be changed.
parent
366a16ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/anet.c
View file @
5198b513
...
...
@@ -69,6 +69,11 @@ int anetSetBlock(char *err, int fd, int non_block) {
return
ANET_ERR
;
}
/* Check if this flag has been set or unset, if so,
* then there is no need to call fcntl to set/unset it again. */
if
(
!!
(
flags
&
O_NONBLOCK
)
==
!!
non_block
)
return
ANET_OK
;
if
(
non_block
)
flags
|=
O_NONBLOCK
;
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment