From bcdae74167d2e1f9d8dd9b01fb368bf8bcc2287d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 27 Sep 2013 09:49:39 +0000 Subject: -undo #29640, somehow causes problems --- src/util/test_server_with_client_unix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/util/test_server_with_client_unix.c') 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); -- cgit v1.2.3-70-g09d2