summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-18 14:01:13 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-18 21:45:27 -0400
commitf7a5bb2842037fa27dbc99d92c3fee7fe1bbbc2a (patch)
treee56e66388ea78ea1ee96ae3cce3318c4abc1a423 /src/journal
parent6b9732b2bf0499c5e4ea8a9d4f6051d98033f680 (diff)
Small modernizations
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/coredumpctl.c3
-rw-r--r--src/journal/journald-native.c9
2 files changed, 5 insertions, 7 deletions
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index d1450c09a2..e5f4d4571a 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -131,11 +131,10 @@ static int add_match(Set *set, const char *match) {
goto fail;
log_debug("Adding pattern: %s", pattern);
- r = set_put(set, pattern);
+ r = set_consume(set, pattern);
if (r < 0) {
log_error("Failed to add pattern '%s': %s",
pattern, strerror(-r));
- free(pattern);
goto fail;
}
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 0f3936a146..d73280c8cf 100644
--- a/src/journal/journald-native.c
+++ b/src/journal/journald-native.c
@@ -383,12 +383,15 @@ void server_process_native_file(
}
int server_open_native_socket(Server*s) {
- union sockaddr_union sa;
int one, r;
assert(s);
if (s->native_fd < 0) {
+ union sockaddr_union sa = {
+ .un.sun_family = AF_UNIX,
+ .un.sun_path = "/run/systemd/journal/socket",
+ };
s->native_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
if (s->native_fd < 0) {
@@ -396,10 +399,6 @@ int server_open_native_socket(Server*s) {
return -errno;
}
- zero(sa);
- sa.un.sun_family = AF_UNIX;
- strncpy(sa.un.sun_path, "/run/systemd/journal/socket", sizeof(sa.un.sun_path));
-
unlink(sa.un.sun_path);
r = bind(s->native_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));