chiark / gitweb /
test: allow deletion of temporary files from normal fs
[elogind.git] / src / journal / journald.c
index 3e7581815b562d849ea2698a605f501d0befa990..af136e566733477f835ce04311ff6f616ccb1e8a 100644 (file)
@@ -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;
                 }
 
@@ -721,7 +721,7 @@ static void driver_message(Server *s, sd_id128_t message_id, const char *format,
         assert(s);
         assert(format);
 
-        IOVEC_SET_STRING(iovec[n++], "PRIORITY=5");
+        IOVEC_SET_STRING(iovec[n++], "PRIORITY=6");
         IOVEC_SET_STRING(iovec[n++], "_TRANSPORT=driver");
 
         memcpy(buffer, "MESSAGE=", 8);
@@ -1174,6 +1174,7 @@ static void process_syslog_message(Server *s, const char *buf, struct ucred *ucr
         free(syslog_priority);
         free(syslog_facility);
         free(syslog_identifier);
+        free(syslog_pid);
 }
 
 static bool valid_user_field(const char *p, size_t l) {
@@ -1270,7 +1271,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 +1358,7 @@ static void process_native_message(
 
                         k = malloc((e - p) + 1 + l);
                         if (!k) {
-                                log_error("Out of memory");
+                                log_oom();
                                 break;
                         }
 
@@ -1450,7 +1451,7 @@ static void process_native_file(
 
         p = malloc(st.st_size);
         if (!p) {
-                log_error("Out of memory");
+                log_oom();
                 return;
         }
 
@@ -1542,10 +1543,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 +1556,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 +1758,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;
@@ -2225,6 +2221,8 @@ static int process_event(Server *s, struct epoll_event *ev) {
                         return -errno;
                 }
 
+                log_info("Received SIG%s", signal_to_string(sfsi.ssi_signo));
+
                 if (sfsi.ssi_signo == SIGUSR1) {
                         touch("/run/systemd/journal/flushed");
                         server_flush_to_var(s);
@@ -2237,7 +2235,6 @@ static int process_event(Server *s, struct epoll_event *ev) {
                         return 1;
                 }
 
-                log_debug("Received SIG%s", signal_to_string(sfsi.ssi_signo));
                 return 0;
 
         } else if (ev->data.fd == s->proc_kmsg_fd) {
@@ -2752,10 +2749,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) {