diff options
Diffstat (limited to 'libcutils/properties.c')
| -rw-r--r-- | libcutils/properties.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libcutils/properties.c b/libcutils/properties.c index 6c3aab88..9c46b795 100644 --- a/libcutils/properties.c +++ b/libcutils/properties.c @@ -100,10 +100,7 @@ static int connectToServer(const char* fileName) int sock = -1; int cc; - union { - struct sockaddr_un un; - struct sockaddr generic; - } addr; + struct sockaddr_un addr; sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { @@ -112,9 +109,9 @@ static int connectToServer(const char* fileName) } /* connect to socket; fails if file doesn't exist */ - strcpy(addr.un.sun_path, fileName); // max 108 bytes - addr.un.sun_family = AF_UNIX; - cc = connect(sock, &addr.generic, SUN_LEN(&addr.un)); + strcpy(addr.sun_path, fileName); // max 108 bytes + addr.sun_family = AF_UNIX; + cc = connect(sock, (struct sockaddr*) &addr, SUN_LEN(&addr)); if (cc < 0) { // ENOENT means socket file doesn't exist // ECONNREFUSED means socket exists but nobody is listening |
