diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2014-12-08 17:39:57 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-01-15 10:33:01 +0100 |
commit | f3d91181d4ee9da3f8bbf4ddf8782951c0ae46c1 (patch) | |
tree | bac7a56e6bf8d336437396d937f01ed1d04ebd11 /src/util/util.h | |
parent | 0e8a48e38e467b05951d2719956f8c0d5aed76b3 (diff) | |
download | sssd-f3d91181d4ee9da3f8bbf4ddf8782951c0ae46c1.tar.gz sssd-f3d91181d4ee9da3f8bbf4ddf8782951c0ae46c1.tar.xz sssd-f3d91181d4ee9da3f8bbf4ddf8782951c0ae46c1.zip |
UTIL: Unify the fd_nonblocking implementation
The responder and child_common modules each had their own
implementation. Unify it instead and add a unit test.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/util/util.h')
-rw-r--r-- | src/util/util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/util.h b/src/util/util.h index 45efd1aef..60dbf9381 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -26,6 +26,7 @@ #include <stdint.h> #include <stdbool.h> #include <unistd.h> +#include <fcntl.h> #include <string.h> #include <strings.h> #include <ctype.h> @@ -444,6 +445,17 @@ errno_t sss_hash_create_ex(TALLOC_CTX *mem_ctx, errno_t add_strings_lists(TALLOC_CTX *mem_ctx, const char **l1, const char **l2, bool copy_strings, char ***_new_list); +/** + * @brief set file descriptor as nonblocking + * + * Set the O_NONBLOCK flag for the input fd + * + * @param[in] fd The file descriptor to set as nonblocking + * + * @return EOK on success, errno code otherwise + */ +errno_t sss_fd_nonblocking(int fd); + /* Copy a NULL-terminated string list * Returns NULL on out of memory error or invalid input */ |