summaryrefslogtreecommitdiff
path: root/src/journal/journald.c
diff options
context:
space:
mode:
authorShawn Landden <shawnlandden@gmail.com>2012-07-25 14:55:59 -0700
committerKay Sievers <kay@vrfy.org>2012-07-26 11:48:26 +0200
commit0d0f0c50d3a1d90f03972a6abb82e6413daaa583 (patch)
tree74f41c8455dbd78599f49300315a2569a8989992 /src/journal/journald.c
parente146e4516b9ea9907852e7ad609de39dca9e8769 (diff)
log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors that didn't print errors, not properly forwarding error codes, few more consistency issues, et cetera
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r--src/journal/journald.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c
index ae1fbc4bd4..5602e362df 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -393,7 +393,7 @@ static void server_vacuum(Server *s) {
if (s->system_journal) {
if (asprintf(&p, "/var/log/journal/%s", ids) < 0) {
- log_error("Out of memory.");
+ log_oom();
return;
}
@@ -405,7 +405,7 @@ static void server_vacuum(Server *s) {
if (s->runtime_journal) {
if (asprintf(&p, "/run/log/journal/%s", ids) < 0) {
- log_error("Out of memory.");
+ log_oom();
return;
}
@@ -1270,7 +1270,7 @@ static void process_native_message(
u = MAX((n+N_IOVEC_META_FIELDS+1) * 2U, 4U);
c = realloc(iovec, u * sizeof(struct iovec));
if (!c) {
- log_error("Out of memory.");
+ log_oom();
break;
}
@@ -1357,7 +1357,7 @@ static void process_native_message(
k = malloc((e - p) + 1 + l);
if (!k) {
- log_error("Out of memory.");
+ log_oom();
break;
}
@@ -1450,7 +1450,7 @@ static void process_native_file(
p = malloc(st.st_size);
if (!p) {
- log_error("Out of memory.");
+ log_oom();
return;
}
@@ -1542,10 +1542,8 @@ static int stdout_stream_line(StdoutStream *s, char *p) {
s->identifier = NULL;
else {
s->identifier = strdup(p);
- if (!s->identifier) {
- log_error("Out of memory.");
- return -ENOMEM;
- }
+ if (!s->identifier)
+ return log_oom();
}
s->state = STDOUT_STREAM_UNIT_ID;
@@ -1557,10 +1555,8 @@ static int stdout_stream_line(StdoutStream *s, char *p) {
s->unit_id = NULL;
else {
s->unit_id = strdup(p);
- if (!s->unit_id) {
- log_error("Out of memory.");
- return -ENOMEM;
- }
+ if (!s->unit_id)
+ return log_oom();
}
}
@@ -1761,9 +1757,8 @@ static int stdout_stream_new(Server *s) {
stream = new0(StdoutStream, 1);
if (!stream) {
- log_error("Out of memory.");
close_nointr_nofail(fd);
- return -ENOMEM;
+ return log_oom();
}
stream->fd = fd;
@@ -2753,10 +2748,8 @@ static int server_init(Server *s) {
server_parse_proc_cmdline(s);
s->user_journals = hashmap_new(trivial_hash_func, trivial_compare_func);
- if (!s->user_journals) {
- log_error("Out of memory.");
- return -ENOMEM;
- }
+ if (!s->user_journals)
+ return log_oom();
s->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (s->epoll_fd < 0) {