From b1389b0d0805392570085acc7cb10eafcf885405 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 11 Oct 2014 11:37:37 -0400
Subject: [PATCH] Modernization
---
src/core/load-fragment.c | 14 ++++++--------
src/journal/journald-server.c | 5 ++---
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 0620882b4e..6b6f9908b5 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -288,7 +288,8 @@ int config_parse_socket_listen(const char *unit,
void *data,
void *userdata) {
- SocketPort *p, *tail;
+ _cleanup_free_ SocketPort *p = NULL;
+ SocketPort *tail;
Socket *s;
int r;
@@ -315,10 +316,9 @@ int config_parse_socket_listen(const char *unit,
r = unit_full_printf(UNIT(s), rvalue, &p->path);
if (r < 0) {
p->path = strdup(rvalue);
- if (!p->path) {
- free(p);
+ if (!p->path)
return log_oom();
- } else
+ else
log_syntax(unit, LOG_ERR, filename, line, -r,
"Failed to resolve unit specifiers on %s, ignoring: %s", rvalue, strerror(-r));
}
@@ -334,11 +334,10 @@ int config_parse_socket_listen(const char *unit,
log_syntax(unit, LOG_ERR, filename, line, -r,
"Failed to resolve unit specifiers on %s, ignoring: %s", rvalue, strerror(-r));
- r = socket_address_parse_netlink(&p->address, k ? k : rvalue);
+ r = socket_address_parse_netlink(&p->address, k ?: rvalue);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, -r,
"Failed to parse address value, ignoring: %s", rvalue);
- free(p);
return 0;
}
@@ -355,7 +354,6 @@ int config_parse_socket_listen(const char *unit,
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, -r,
"Failed to parse address value, ignoring: %s", rvalue);
- free(p);
return 0;
}
@@ -371,7 +369,6 @@ int config_parse_socket_listen(const char *unit,
if (socket_address_family(&p->address) != AF_LOCAL && p->address.type == SOCK_SEQPACKET) {
log_syntax(unit, LOG_ERR, filename, line, ENOTSUP,
"Address family not supported, ignoring: %s", rvalue);
- free(p);
return 0;
}
}
@@ -384,6 +381,7 @@ int config_parse_socket_listen(const char *unit,
LIST_INSERT_AFTER(port, s->ports, tail, p);
} else
LIST_PREPEND(port, s->ports, p);
+ p = NULL;
return 0;
}
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 3df7416397..52111f75a0 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1475,9 +1475,8 @@ int server_init(Server *s) {
server_parse_config_file(s);
server_parse_proc_cmdline(s);
if (!!s->rate_limit_interval ^ !!s->rate_limit_burst) {
- log_debug("Setting both rate limit interval and burst from %llu,%u to 0,0",
- (long long unsigned) s->rate_limit_interval,
- s->rate_limit_burst);
+ log_debug("Setting both rate limit interval and burst from "USEC_FMT",%u to 0,0",
+ s->rate_limit_interval, s->rate_limit_burst);
s->rate_limit_interval = s->rate_limit_burst = 0;
}