diff options
| author | 2024-08-12 16:09:47 +0200 | |
|---|---|---|
| committer | 2024-08-12 16:09:47 +0200 | |
| commit | 755fdbd7373fbd8e0e509d6a2e50d92b5b5a71df (patch) | |
| tree | 56d5f3a9d8111b359e31bdfcc34ca3a4d3101e35 /xs_unix_socket.h | |
| parent | Backport from xs. (diff) | |
| download | penes-snac2-755fdbd7373fbd8e0e509d6a2e50d92b5b5a71df.tar.gz penes-snac2-755fdbd7373fbd8e0e509d6a2e50d92b5b5a71df.tar.xz penes-snac2-755fdbd7373fbd8e0e509d6a2e50d92b5b5a71df.zip | |
Variable renaming in xs_unix_socket, because it collides in Illumos.
Diffstat (limited to 'xs_unix_socket.h')
| -rw-r--r-- | xs_unix_socket.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xs_unix_socket.h b/xs_unix_socket.h index 5b64282..3eb2307 100644 --- a/xs_unix_socket.h +++ b/xs_unix_socket.h | |||
| @@ -20,15 +20,15 @@ int xs_unix_socket_server(const char *path, const char *grp) | |||
| 20 | int rs = -1; | 20 | int rs = -1; |
| 21 | 21 | ||
| 22 | if ((rs = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { | 22 | if ((rs = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { |
| 23 | struct sockaddr_un sun = {0}; | 23 | struct sockaddr_un su = {0}; |
| 24 | mode_t mode = 0666; | 24 | mode_t mode = 0666; |
| 25 | 25 | ||
| 26 | sun.sun_family = AF_UNIX; | 26 | su.sun_family = AF_UNIX; |
| 27 | strncpy(sun.sun_path, path, sizeof(sun.sun_path)); | 27 | strncpy(su.sun_path, path, sizeof(su.sun_path)); |
| 28 | 28 | ||
| 29 | unlink(path); | 29 | unlink(path); |
| 30 | 30 | ||
| 31 | if (bind(rs, (struct sockaddr *)&sun, sizeof(sun)) == -1) { | 31 | if (bind(rs, (struct sockaddr *)&su, sizeof(su)) == -1) { |
| 32 | close(rs); | 32 | close(rs); |
| 33 | return -1; | 33 | return -1; |
| 34 | } | 34 | } |
| @@ -58,12 +58,12 @@ int xs_unix_socket_connect(const char *path) | |||
| 58 | int d = -1; | 58 | int d = -1; |
| 59 | 59 | ||
| 60 | if ((d = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { | 60 | if ((d = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { |
| 61 | struct sockaddr_un sun = {0}; | 61 | struct sockaddr_un su = {0}; |
| 62 | 62 | ||
| 63 | sun.sun_family = AF_UNIX; | 63 | su.sun_family = AF_UNIX; |
| 64 | strncpy(sun.sun_path, path, sizeof(sun.sun_path)); | 64 | strncpy(su.sun_path, path, sizeof(su.sun_path)); |
| 65 | 65 | ||
| 66 | if (connect(d, (struct sockaddr *)&sun, sizeof(sun)) == -1) { | 66 | if (connect(d, (struct sockaddr *)&su, sizeof(su)) == -1) { |
| 67 | close(d); | 67 | close(d); |
| 68 | d = -1; | 68 | d = -1; |
| 69 | } | 69 | } |