aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-05 16:16:46 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-05 16:16:46 +0000
commit69a23725d6937db68fc8ca2fd1e8490220edc7de (patch)
treeb4a4060dfb25ccf18254e0b726120c9b6bef9ee5 /src/util/common_logging.c
parentcf96e25a7a3c3864bb936b1b82fd086ca8d16a5e (diff)
downloadgnunet-69a23725d6937db68fc8ca2fd1e8490220edc7de.tar.gz
gnunet-69a23725d6937db68fc8ca2fd1e8490220edc7de.zip
UNIX domain socket support
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 73a374f46..c06aadc2f 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -510,7 +510,9 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
510 static char buf[INET6_ADDRSTRLEN + 8]; 510 static char buf[INET6_ADDRSTRLEN + 8];
511 static char b2[6]; 511 static char b2[6];
512 const struct sockaddr_in *v4; 512 const struct sockaddr_in *v4;
513 const struct sockaddr_un *un;
513 const struct sockaddr_in6 *v6; 514 const struct sockaddr_in6 *v6;
515 unsigned int off;
514 516
515 if (addr == NULL) 517 if (addr == NULL)
516 return _("unknown address"); 518 return _("unknown address");
@@ -535,6 +537,17 @@ GNUNET_a2s (const struct sockaddr *addr, socklen_t addrlen)
535 sprintf (b2, "%u", ntohs (v6->sin6_port)); 537 sprintf (b2, "%u", ntohs (v6->sin6_port));
536 strcat (buf, b2); 538 strcat (buf, b2);
537 return buf; 539 return buf;
540 case AF_UNIX:
541 un = (const struct sockaddr_un*) addr;
542 off = 0;
543 if (un->sun_path[0] == '\0') off++;
544 snprintf (buf,
545 sizeof (buf),
546 "%s%.*s",
547 (off == 1) ? "@" : "",
548 addrlen - sizeof (sa_family_t) - 1 - off,
549 &un->sun_path[off]);
550 return buf;
538 default: 551 default:
539 return _("invalid address"); 552 return _("invalid address");
540 } 553 }