Skip to content

Commit

Permalink
Merge pull request #14749 from tymoteuszblochmobica/fcntl
Browse files Browse the repository at this point in the history
Fcntl  setting improvement,
  • Loading branch information
0xc0170 authored Jun 17, 2021
2 parents 8cb8e49 + bdb0a22 commit c358ab2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions platform/source/mbed_retarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ extern "C" int fcntl(int fildes, int cmd, ...)
switch (cmd) {
case F_GETFL: {
int flags = 0;
if (fhc->is_blocking()) {
if (!fhc->is_blocking()) {
flags |= O_NONBLOCK;
}
return flags;
Expand All @@ -1191,11 +1191,12 @@ extern "C" int fcntl(int fildes, int cmd, ...)
va_start(ap, cmd);
int flags = va_arg(ap, int);
va_end(ap);
int ret = fhc->set_blocking(flags & O_NONBLOCK);
int ret = fhc->set_blocking(!(flags & O_NONBLOCK));
if (ret < 0) {
errno = -ret;
return -1;
}

return 0;
}

Expand Down

0 comments on commit c358ab2

Please sign in to comment.