[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30066 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30066 - gnunet/src/util |
Date: |
Wed, 9 Oct 2013 22:16:52 +0200 |
Author: grothoff
Date: 2013-10-09 22:16:52 +0200 (Wed, 09 Oct 2013)
New Revision: 30066
Modified:
gnunet/src/util/common_logging.c
gnunet/src/util/connection.c
gnunet/src/util/network.c
gnunet/src/util/server.c
Log:
removing remenants of abstract unix domain socket handling, this finishes
addressing #2887
Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c 2013-10-09 20:03:31 UTC (rev 30065)
+++ gnunet/src/util/common_logging.c 2013-10-09 20:16:52 UTC (rev 30066)
@@ -1132,9 +1132,9 @@
* in the entire API that is NOT reentrant!
*
* @param addr the address
- * @param addrlen the length of the address
+ * @param addrlen the length of the address in @a addr
* @return nicely formatted string for the address
- * will be overwritten by next call to GNUNET_a2s.
+ * will be overwritten by next call to #GNUNET_a2s.
*/
const char *
GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
@@ -1178,7 +1178,7 @@
return "<unbound UNIX client>";
un = (const struct sockaddr_un *) addr;
off = 0;
- if (un->sun_path[0] == '\0')
+ if ('\0' == un->sun_path[0])
off++;
memset (buf, 0, sizeof (buf));
snprintf (buf, sizeof (buf) - 1, "%s%.*s", (off == 1) ? "@" : "",
Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c 2013-10-09 20:03:31 UTC (rev 30065)
+++ gnunet/src/util/connection.c 2013-10-09 20:16:52 UTC (rev 30066)
@@ -831,7 +831,7 @@
GNUNET_assert (0 < strlen (unixpath)); /* sanity check */
un = GNUNET_new (struct sockaddr_un);
un->sun_family = AF_UNIX;
- strncpy(un->sun_path, unixpath, sizeof(un->sun_path) - 1);
+ strncpy (un->sun_path, unixpath, sizeof (un->sun_path) - 1);
#if HAVE_SOCKADDR_IN_SIN_LEN
un->sun_len = (u_char) sizeof (struct sockaddr_un);
#endif
Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c 2013-10-09 20:03:31 UTC (rev 30065)
+++ gnunet/src/util/network.c 2013-10-09 20:16:52 UTC (rev 30066)
@@ -393,24 +393,7 @@
socklen_t address_len)
{
int ret;
- socklen_t bind_address_len = address_len;
-#ifdef LINUX
- if (AF_UNIX == address->sa_family)
- {
- const struct sockaddr_un *address_un = (const struct sockaddr_un *)address;
- if (address_un->sun_path[0] == '\0')
- {
- bind_address_len = \
- sizeof (struct sockaddr_un) \
- - sizeof (address_un->sun_path) \
- + strnlen (address_un->sun_path + 1, sizeof (address_un->sun_path) -
1) \
- + 1;
- GNUNET_break (0);
- }
- }
-#endif
-
#ifdef IPV6_V6ONLY
#ifdef IPPROTO_IPV6
{
@@ -444,7 +427,7 @@
old_mask = umask (S_IWGRP | S_IRGRP | S_IXGRP | S_IWOTH | S_IROTH |
S_IXOTH);
#endif
- ret = bind (desc->fd, address, bind_address_len);
+ ret = bind (desc->fd, address, address_len);
#ifndef WINDOWS
if (AF_UNIX == address->sa_family)
(void) umask (old_mask);
@@ -564,21 +547,6 @@
{
int ret;
-#ifdef LINUX
- if (address->sa_family == AF_UNIX)
- {
- const struct sockaddr_un *address_un = (const struct sockaddr_un *)address;
- if (address_un->sun_path[0] == '\0')
- {
- address_len = \
- sizeof (struct sockaddr_un) \
- - sizeof (address_un->sun_path) \
- + strnlen (address_un->sun_path + 1, sizeof (address_un->sun_path) -
1) \
- + 1;
- GNUNET_break (0);
- }
- }
-#endif
ret = connect (desc->fd, address, address_len);
#ifdef MINGW
@@ -803,18 +771,6 @@
#ifdef MSG_NOSIGNAL
flags |= MSG_NOSIGNAL;
#endif
-#ifdef LINUX
- if (dest_addr->sa_family == AF_UNIX)
- {
- const struct sockaddr_un *dest_addr_un = (const struct sockaddr_un
*)dest_addr;
- if (dest_addr_un->sun_path[0] == '\0')
- dest_len = \
- sizeof (struct sockaddr_un) \
- - sizeof (dest_addr_un->sun_path) \
- + strnlen (dest_addr_un->sun_path + 1, sizeof (dest_addr_un->sun_path)
- 1) \
- + 1;
- }
-#endif
ret = sendto (desc->fd, message, length, flags, dest_addr, dest_len);
#ifdef MINGW
if (SOCKET_ERROR == ret)
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2013-10-09 20:03:31 UTC (rev 30065)
+++ gnunet/src/util/server.c 2013-10-09 20:16:52 UTC (rev 30066)
@@ -495,15 +495,10 @@
(AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
else if (AF_UNIX == server_addr->sa_family)
{
- const struct sockaddr_un *un = (const struct sockaddr_un *) server_addr;
- unsigned int off = 0;
-
- if ('\0' == un->sun_path[0])
- off = 1; /* some UNIXPATHs start with 0 */
LOG (GNUNET_ERROR_TYPE_WARNING,
- _("`%s' failed for `%.*s': address already in use\n"), "bind",
- (int) ((sizeof (un->sun_path) - off)),
- (&un->sun_path[off]));
+ _("`%s' failed for `%s': address already in use\n"),
+ "bind",
+ GNUNET_a2s (server_addr, socklen));
}
}
GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
@@ -531,7 +526,7 @@
* @param access_cls closure for access
* @param lsocks NULL-terminated array of listen sockets
* @param idle_timeout after how long should we timeout idle connections?
- * @param require_found if YES, connections sending messages of unknown type
+ * @param require_found if #GNUNET_YES, connections sending messages of
unknown type
* will be closed
* @return handle for the new server, NULL on error
* (typically, "port" already in use)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30066 - gnunet/src/util,
gnunet <=