X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournald.c;h=ea23cff26e108e6875d52b19458c5c2e88dd81b2;hp=93cdec6c6c6dacebdec54994c30c80012aea21cf;hb=79c077224be5a868d0bba66972ef9546dae85977;hpb=5e62067d08d989ab98b12497a9b27a877de8515b diff --git a/src/journal/journald.c b/src/journal/journald.c index 93cdec6c6..ea23cff26 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -29,13 +29,13 @@ #include #include #include -#include #include #include #include #include +#include "mkdir.h" #include "hashmap.h" #include "journal-file.h" #include "socket-util.h" @@ -154,13 +154,10 @@ static uint64_t available_space(Server *s) { for (;;) { struct stat st; struct dirent buf, *de; - int k; - k = readdir_r(d, &buf, &de); - if (k != 0) { - r = -k; - goto finish; - } + r = readdir_r(d, &buf, &de); + if (r != 0) + break; if (!de) break; @@ -612,7 +609,15 @@ retry: else { r = journal_file_append_entry(f, NULL, iovec, n, &s->seqnum, NULL, NULL); - if ((r == -EBADMSG || r == -E2BIG) && !vacuumed) { + if ((r == -E2BIG || /* hit limit */ + r == -EFBIG || /* hit fs limit */ + r == -EDQUOT || /* quota hit */ + r == -ENOSPC || /* disk full */ + r == -EBADMSG || /* corrupted */ + r == -ENODATA || /* truncated */ + r == -EHOSTDOWN || /* other machine */ + r == -EPROTONOSUPPORT) && /* unsupported feature */ + !vacuumed) { if (r == -E2BIG) log_info("Allocation limit reached, rotating."); @@ -1254,6 +1259,7 @@ static void process_native_message( p = e + 1; continue; } else { + le64_t l_le; uint64_t l; char *k; @@ -1262,8 +1268,8 @@ static void process_native_message( break; } - memcpy(&l, e + 1, sizeof(uint64_t)); - l = le64toh(l); + memcpy(&l_le, e + 1, sizeof(uint64_t)); + l = le64toh(l_le); if (remaining < e - p + 1 + sizeof(uint64_t) + l + 1 || e[1+sizeof(uint64_t)+l] != '\n') { @@ -1918,7 +1924,7 @@ static int system_journal_open(Server *s) { * if it already exists, so that we can flush * it into the system journal */ - r = journal_file_open_reliably(fn, O_RDWR, 0640, NULL, &s->runtime_journal); + r = journal_file_open(fn, O_RDWR, 0640, NULL, &s->runtime_journal); free(fn); if (r < 0) { @@ -2144,10 +2150,20 @@ static int process_event(Server *s, struct epoll_event *ev) { size_t label_len = 0; union { struct cmsghdr cmsghdr; + + /* We use NAME_MAX space for the + * SELinux label here. The kernel + * currently enforces no limit, but + * according to suggestions from the + * SELinux people this will change and + * it will probably be identical to + * NAME_MAX. For now we use that, but + * this should be updated one day when + * the final limit is known.*/ uint8_t buf[CMSG_SPACE(sizeof(struct ucred)) + CMSG_SPACE(sizeof(struct timeval)) + - CMSG_SPACE(sizeof(int)) + - CMSG_SPACE(PAGE_SIZE)]; /* selinux label */ + CMSG_SPACE(sizeof(int)) + /* fd */ + CMSG_SPACE(NAME_MAX)]; /* selinux label */ } control; ssize_t n; int v; @@ -2569,7 +2585,7 @@ static int server_parse_config_file(Server *s) { assert(s); - fn = "/etc/systemd/systemd-journald.conf"; + fn = "/etc/systemd/journald.conf"; f = fopen(fn, "re"); if (!f) { if (errno == ENOENT) @@ -2750,6 +2766,7 @@ int main(int argc, char *argv[]) { } log_set_target(LOG_TARGET_CONSOLE); + log_set_facility(LOG_SYSLOG); log_parse_environment(); log_open();