diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xfuncs.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index a02a504b0..23f27516f 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -25,19 +25,25 @@ | |||
25 | #include "libbb.h" | 25 | #include "libbb.h" |
26 | 26 | ||
27 | /* Turn on nonblocking I/O on a fd */ | 27 | /* Turn on nonblocking I/O on a fd */ |
28 | int FAST_FUNC ndelay_on(int fd) | 28 | void FAST_FUNC ndelay_on(int fd) |
29 | { | 29 | { |
30 | return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); | 30 | int flags = fcntl(fd, F_GETFL); |
31 | if (flags & O_NONBLOCK) | ||
32 | return; | ||
33 | fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
31 | } | 34 | } |
32 | 35 | ||
33 | int FAST_FUNC ndelay_off(int fd) | 36 | void FAST_FUNC ndelay_off(int fd) |
34 | { | 37 | { |
35 | return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK); | 38 | int flags = fcntl(fd, F_GETFL); |
39 | if (!(flags & O_NONBLOCK)) | ||
40 | return; | ||
41 | fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); | ||
36 | } | 42 | } |
37 | 43 | ||
38 | int FAST_FUNC close_on_exec_on(int fd) | 44 | void FAST_FUNC close_on_exec_on(int fd) |
39 | { | 45 | { |
40 | return fcntl(fd, F_SETFD, FD_CLOEXEC); | 46 | fcntl(fd, F_SETFD, FD_CLOEXEC); |
41 | } | 47 | } |
42 | 48 | ||
43 | char* FAST_FUNC strncpy_IFNAMSIZ(char *dst, const char *src) | 49 | char* FAST_FUNC strncpy_IFNAMSIZ(char *dst, const char *src) |