summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-02-26 19:34:40 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-02-26 19:34:40 +0000
commit431735f005af79407e01a68995ac6dde7ff4b815 (patch)
tree711bc5041e8df789e39f06024abef94f466944e2
parentebb46d76e4bf4ee4f34b42709ea69cce07e3e322 (diff)
parenta7e2e7634c4242a9ab2fa7c8031a5745beac613f (diff)
downloadsystem_core-431735f005af79407e01a68995ac6dde7ff4b815.zip
system_core-431735f005af79407e01a68995ac6dde7ff4b815.tar.gz
system_core-431735f005af79407e01a68995ac6dde7ff4b815.tar.bz2
Merge "libcutils: Socket type might contain bitwise OR flags"
-rw-r--r--libcutils/socket_local_server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libcutils/socket_local_server.c b/libcutils/socket_local_server.c
index 4971b1b..7628fe4 100644
--- a/libcutils/socket_local_server.c
+++ b/libcutils/socket_local_server.c
@@ -43,6 +43,8 @@ int socket_local_server(const char *name, int namespaceId, int type)
#define LISTEN_BACKLOG 4
+/* Only the bottom bits are really the socket type; there are flags too. */
+#define SOCK_TYPE_MASK 0xf
/**
* Binds a pre-created socket(AF_LOCAL) 's' to 'name'
@@ -107,7 +109,7 @@ int socket_local_server(const char *name, int namespace, int type)
return -1;
}
- if (type == SOCK_STREAM) {
+ if ((type & SOCK_TYPE_MASK) == SOCK_STREAM) {
int ret;
ret = listen(s, LISTEN_BACKLOG);