diff options
author | 2015-09-22 12:33:20 -0700 | |
---|---|---|
committer | 2015-09-22 12:33:20 -0700 | |
commit | a82950e68318a6aab6fe894fa39f7fa616c4647b (patch) | |
tree | 7d02bd1e9e1cbae1f14ad4ad1e06d3ae81a96dfe /src/core/iomgr/socket_utils_posix.c | |
parent | 8af4c337181322cc4fb396199c90f574cfb4163f (diff) |
clang-format all core files
Diffstat (limited to 'src/core/iomgr/socket_utils_posix.c')
-rw-r--r-- | src/core/iomgr/socket_utils_posix.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/core/iomgr/socket_utils_posix.c b/src/core/iomgr/socket_utils_posix.c index 1e32d7461f..3c56b46744 100644 --- a/src/core/iomgr/socket_utils_posix.c +++ b/src/core/iomgr/socket_utils_posix.c @@ -43,35 +43,27 @@ #include <grpc/support/log.h> -int -grpc_accept4 (int sockfd, struct sockaddr *addr, socklen_t * addrlen, int nonblock, int cloexec) -{ +int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, + int nonblock, int cloexec) { int fd, flags; - fd = accept (sockfd, addr, addrlen); - if (fd >= 0) - { - if (nonblock) - { - flags = fcntl (fd, F_GETFL, 0); - if (flags < 0) - goto close_and_error; - if (fcntl (fd, F_SETFL, flags | O_NONBLOCK) != 0) - goto close_and_error; - } - if (cloexec) - { - flags = fcntl (fd, F_GETFD, 0); - if (flags < 0) - goto close_and_error; - if (fcntl (fd, F_SETFD, flags | FD_CLOEXEC) != 0) - goto close_and_error; - } + fd = accept(sockfd, addr, addrlen); + if (fd >= 0) { + if (nonblock) { + flags = fcntl(fd, F_GETFL, 0); + if (flags < 0) goto close_and_error; + if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) != 0) goto close_and_error; } + if (cloexec) { + flags = fcntl(fd, F_GETFD, 0); + if (flags < 0) goto close_and_error; + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) != 0) goto close_and_error; + } + } return fd; close_and_error: - close (fd); + close(fd); return -1; } |