diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-12-07 15:22:22 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-12-07 15:22:22 -0500 |
commit | dc0f355f0ace3538dfea541907aca53ec2ff9590 (patch) | |
tree | 2477d9b97da6833d08adce8d532a41adb6e86cb6 /wayland-client.c | |
parent | cb703161057aeb3f4de0faed9f8ff5005efa71a3 (diff) |
Fix API to always include socket name length.
Diffstat (limited to 'wayland-client.c')
-rw-r--r-- | wayland-client.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/wayland-client.c b/wayland-client.c index 7a0fa75..26eebce 100644 --- a/wayland-client.c +++ b/wayland-client.c @@ -83,11 +83,11 @@ connection_update(struct wl_connection *connection, } WL_EXPORT struct wl_display * -wl_display_create(const char *address) +wl_display_create(const char *name, size_t name_size) { struct wl_display *display; struct wl_global *global; - struct sockaddr_un name; + struct sockaddr_un addr; socklen_t size; char buffer[256]; uint32_t id, length, count, i; @@ -103,12 +103,12 @@ wl_display_create(const char *address) return NULL; } - name.sun_family = AF_LOCAL; - memcpy(name.sun_path, address, strlen(address + 1) + 2); + addr.sun_family = AF_LOCAL; + memcpy(addr.sun_path, name, name_size); - size = offsetof (struct sockaddr_un, sun_path) + sizeof socket_name; + size = offsetof (struct sockaddr_un, sun_path) + name_size; - if (connect(display->fd, (struct sockaddr *) &name, size) < 0) { + if (connect(display->fd, (struct sockaddr *) &addr, size) < 0) { close(display->fd); free(display); return NULL; |