diff options
Diffstat (limited to 'src/util/test_server_with_client_unix.c')
-rw-r--r-- | src/util/test_server_with_client_unix.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/test_server_with_client_unix.c b/src/util/test_server_with_client_unix.c index a4e0ffe5d..57a67d3f4 100644 --- a/src/util/test_server_with_client_unix.c +++ b/src/util/test_server_with_client_unix.c | |||
@@ -134,15 +134,20 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
134 | { | 134 | { |
135 | struct sockaddr_un un; | 135 | struct sockaddr_un un; |
136 | const char *unixpath = "/tmp/testsock"; | 136 | const char *unixpath = "/tmp/testsock"; |
137 | size_t slen = strlen (unixpath); | ||
137 | struct sockaddr *sap[2]; | 138 | struct sockaddr *sap[2]; |
138 | socklen_t slens[2]; | 139 | socklen_t slens[2]; |
139 | 140 | ||
140 | memset (&un, 0, sizeof (un)); | 141 | memset (&un, 0, sizeof (un)); |
141 | un.sun_family = AF_UNIX; | 142 | un.sun_family = AF_UNIX; |
142 | strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1); | 143 | memcpy (un.sun_path, unixpath, slen); |
144 | un.sun_path[slen] = '\0'; | ||
143 | #if HAVE_SOCKADDR_IN_SIN_LEN | 145 | #if HAVE_SOCKADDR_IN_SIN_LEN |
144 | un.sun_len = (u_char) sizeof (un); | 146 | un.sun_len = (u_char) sizeof (un); |
145 | #endif | 147 | #endif |
148 | #if LINUX | ||
149 | un.sun_path[0] = '\0'; | ||
150 | #endif | ||
146 | 151 | ||
147 | sap[0] = (struct sockaddr *) &un; | 152 | sap[0] = (struct sockaddr *) &un; |
148 | slens[0] = sizeof (un); | 153 | slens[0] = sizeof (un); |