diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-26 18:48:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-26 18:48:59 +0000 |
commit | fa7d6b32530d3d8c2d7e542a15319c74c22061b6 (patch) | |
tree | 8f4c7615c89f646a66fc709b698ef81becdf1ad1 /src/util/connection.c | |
parent | d79a03493ba5d0581e828724a402a2054429e7be (diff) | |
download | gnunet-fa7d6b32530d3d8c2d7e542a15319c74c22061b6.tar.gz gnunet-fa7d6b32530d3d8c2d7e542a15319c74c22061b6.zip |
moving from abstract unix domain socket paths to normal unix domain socket paths (#2887), removing now unnecessary/dead flags argument to GNUNET_NETWORK_socket_bind
Diffstat (limited to 'src/util/connection.c')
-rw-r--r-- | src/util/connection.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/util/connection.c b/src/util/connection.c index 3290abcfc..c8d9919ea 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -828,22 +828,13 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | |||
828 | #ifdef AF_UNIX | 828 | #ifdef AF_UNIX |
829 | struct GNUNET_CONNECTION_Handle *connection; | 829 | struct GNUNET_CONNECTION_Handle *connection; |
830 | struct sockaddr_un *un; | 830 | struct sockaddr_un *un; |
831 | size_t slen; | ||
832 | 831 | ||
833 | GNUNET_assert (0 < strlen (unixpath)); /* sanity check */ | 832 | GNUNET_assert (0 < strlen (unixpath)); /* sanity check */ |
834 | un = GNUNET_new (struct sockaddr_un); | 833 | un = GNUNET_new (struct sockaddr_un); |
835 | un->sun_family = AF_UNIX; | 834 | un->sun_family = AF_UNIX; |
836 | slen = strlen (unixpath); | 835 | strncpy(un->sun_path, unixpath, sizeof(un->sun_path) - 1); |
837 | if (slen >= sizeof (un->sun_path)) | ||
838 | slen = sizeof (un->sun_path) - 1; | ||
839 | memcpy (un->sun_path, unixpath, slen); | ||
840 | un->sun_path[slen] = '\0'; | ||
841 | slen = sizeof (struct sockaddr_un); | ||
842 | #if HAVE_SOCKADDR_IN_SIN_LEN | 836 | #if HAVE_SOCKADDR_IN_SIN_LEN |
843 | un->sun_len = (u_char) slen; | 837 | un->sun_len = (u_char) sizeof (struct sockaddr_un); |
844 | #endif | ||
845 | #if LINUX | ||
846 | un->sun_path[0] = '\0'; | ||
847 | #endif | 838 | #endif |
848 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); | 839 | connection = GNUNET_new (struct GNUNET_CONNECTION_Handle); |
849 | connection->cfg = cfg; | 840 | connection->cfg = cfg; |
@@ -852,7 +843,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | |||
852 | connection->port = 0; | 843 | connection->port = 0; |
853 | connection->hostname = NULL; | 844 | connection->hostname = NULL; |
854 | connection->addr = (struct sockaddr *) un; | 845 | connection->addr = (struct sockaddr *) un; |
855 | connection->addrlen = slen; | 846 | connection->addrlen = sizeof (struct sockaddr_un); |
856 | connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); | 847 | connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); |
857 | if (NULL == connection->sock) | 848 | if (NULL == connection->sock) |
858 | { | 849 | { |