[systemd-commits] 2 commits - man/machinectl.xml src/shared
Zbigniew Jędrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Wed Mar 11 07:08:32 PDT 2015
man/machinectl.xml | 8 ++++----
src/shared/socket-util.c | 44 ++++++++++++++++++++++----------------------
2 files changed, 26 insertions(+), 26 deletions(-)
New commits:
commit 16eb4024887b1b79fc56706fda25eadaecdef2d4
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Mar 11 10:04:49 2015 -0400
man: fix links to compressors
diff --git a/man/machinectl.xml b/man/machinectl.xml
index be72d23..f672915 100644
--- a/man/machinectl.xml
+++ b/man/machinectl.xml
@@ -883,10 +883,10 @@
<citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>tar</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>xz</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>gzip</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>bzip2</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ <citerefentry project='die-net'><refentrytitle>tar</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry project='die-net'><refentrytitle>xz</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry project='die-net'><refentrytitle>gzip</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry project='die-net'><refentrytitle>bzip2</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para>
</refsect1>
commit fc25ad25e019eb2fbce9d3c4be052098cb2c7122
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Tue Mar 10 12:30:12 2015 -0400
socket-util: refactor error handling in sockaddr_pretty
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index 5820279..c832cfe 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -482,6 +482,7 @@ int sockaddr_port(const struct sockaddr *_sa) {
int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret) {
union sockaddr_union *sa = (union sockaddr_union*) _sa;
char *p;
+ int r;
assert(sa);
assert(salen >= sizeof(sa->sa.sa_family));
@@ -493,19 +494,17 @@ int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_
a = ntohl(sa->in.sin_addr.s_addr);
- if (include_port) {
- if (asprintf(&p,
+ if (include_port)
+ r = asprintf(&p,
"%u.%u.%u.%u:%u",
a >> 24, (a >> 16) & 0xFF, (a >> 8) & 0xFF, a & 0xFF,
- ntohs(sa->in.sin_port)) < 0)
- return -ENOMEM;
- } else {
- if (asprintf(&p,
+ ntohs(sa->in.sin_port));
+ else
+ r = asprintf(&p,
"%u.%u.%u.%u",
- a >> 24, (a >> 16) & 0xFF, (a >> 8) & 0xFF, a & 0xFF) < 0)
- return -ENOMEM;
- }
-
+ a >> 24, (a >> 16) & 0xFF, (a >> 8) & 0xFF, a & 0xFF);
+ if (r < 0)
+ return -ENOMEM;
break;
}
@@ -514,30 +513,31 @@ int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF
};
- if (translate_ipv6 && memcmp(&sa->in6.sin6_addr, ipv4_prefix, sizeof(ipv4_prefix)) == 0) {
+ if (translate_ipv6 &&
+ memcmp(&sa->in6.sin6_addr, ipv4_prefix, sizeof(ipv4_prefix)) == 0) {
const uint8_t *a = sa->in6.sin6_addr.s6_addr+12;
- if (include_port) {
- if (asprintf(&p,
+ if (include_port)
+ r = asprintf(&p,
"%u.%u.%u.%u:%u",
a[0], a[1], a[2], a[3],
- ntohs(sa->in6.sin6_port)) < 0)
- return -ENOMEM;
- } else {
- if (asprintf(&p,
+ ntohs(sa->in6.sin6_port));
+ else
+ r = asprintf(&p,
"%u.%u.%u.%u",
- a[0], a[1], a[2], a[3]) < 0)
- return -ENOMEM;
- }
+ a[0], a[1], a[2], a[3]);
+ if (r < 0)
+ return -ENOMEM;
} else {
char a[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, &sa->in6.sin6_addr, a, sizeof(a));
if (include_port) {
- if (asprintf(&p,
+ r = asprintf(&p,
"[%s]:%u",
a,
- ntohs(sa->in6.sin6_port)) < 0)
+ ntohs(sa->in6.sin6_port));
+ if (r < 0)
return -ENOMEM;
} else {
p = strdup(a);
More information about the systemd-commits
mailing list