Created
August 11, 2016 00:07
-
-
Save papertigers/0ef348a097633f20ec71c250b632049d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [link@e0b46710-17df-ed68-a519-edb83e2cc01e ~/smartos-live/projects/illumos/usr/src/uts/common/brand/lx/syscall]$ git diff lx_fcntl.c old.c | |
| diff --git a/usr/src/uts/common/brand/lx/syscall/lx_fcntl.c b/usr/src/uts/common/brand/lx/syscall/lx_fcntl.c | |
| index 2699b9b..9edbd6c 100644 | |
| --- a/usr/src/uts/common/brand/lx/syscall/lx_fcntl.c | |
| +++ b/usr/src/uts/common/brand/lx/syscall/lx_fcntl.c | |
| @@ -173,25 +173,30 @@ lx_fcntl_getfl(int fd) | |
| return (rc); | |
| } | |
| +#define LX_SETFL_MASK (O_NONBLOCK | O_APPEND | O_SYNC | FASYNC); | |
| + | |
| static int | |
| lx_fcntl_setfl(int fd, ulong_t arg) | |
| { | |
| - int new_arg; | |
| + int flags; | |
| + | |
| + flags = fcntl(fd, F_GETFL, 0); | |
| + if (ttolwp(curthread)->lwp_errno != 0) | |
| + return (ttolwp(curthread)->lwp_errno); | |
| + | |
| + flags &= ~LX_SETFL_MASK; | |
| - new_arg = 0; | |
| /* LX_O_NDELAY == LX_O_NONBLOCK, so we only check for one */ | |
| if (arg & LX_O_NDELAY) | |
| - new_arg |= O_NONBLOCK; | |
| + flags |= O_NONBLOCK; | |
| if (arg & LX_O_APPEND) | |
| - new_arg |= O_APPEND; | |
| + flags |= O_APPEND; | |
| if (arg & LX_O_SYNC) | |
| - new_arg |= O_SYNC; | |
| - if (arg & LX_O_LARGEFILE) | |
| - new_arg |= O_LARGEFILE; | |
| + flags |= O_SYNC; | |
| if (arg & LX_O_ASYNC) | |
| - new_arg |= FASYNC; | |
| + flags |= FASYNC; | |
| - return (fcntl(fd, F_SETFL, new_arg)); | |
| + return (fcntl(fd, F_SETFL, flags)); | |
| } | |
| /* The default unprivileged limit in Linux is 1MB */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment