aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_server_with_client_unix.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-27 09:49:39 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-27 09:49:39 +0000
commitbcdae74167d2e1f9d8dd9b01fb368bf8bcc2287d (patch)
treeb1f47d243e677d53de0c3503a1d5caf43dba073e /src/util/test_server_with_client_unix.c
parentdd22c2132e58ba4ac960337efc0f843c12f58780 (diff)
-undo #29640, somehow causes problems
Diffstat (limited to 'src/util/test_server_with_client_unix.c')
-rw-r--r--src/util/test_server_with_client_unix.c7
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 a4e0ffe5d0..57a67d3f45 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)
{
struct sockaddr_un un;
const char *unixpath = "/tmp/testsock";
+ size_t slen = strlen (unixpath);
struct sockaddr *sap[2];
socklen_t slens[2];
memset (&un, 0, sizeof (un));
un.sun_family = AF_UNIX;
- strncpy(un.sun_path, unixpath, sizeof (un.sun_path) - 1);
+ memcpy (un.sun_path, unixpath, slen);
+ un.sun_path[slen] = '\0';
#if HAVE_SOCKADDR_IN_SIN_LEN
un.sun_len = (u_char) sizeof (un);
#endif
+#if LINUX
+ un.sun_path[0] = '\0';
+#endif
sap[0] = (struct sockaddr *) &un;
slens[0] = sizeof (un);