X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournalctl.c;h=db9576c4933f276b4fafb9303525b61756aac5da;hb=a2341f6836da0a217ab0c5f2b82f0c4ea13d429d;hp=386e3505c044ed385f4049e54e126ff16321b86b;hpb=553d2243e2a42783b8bb94addfb752b802c23311;p=elogind.git diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 386e3505c..db9576c49 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1294,7 +1294,7 @@ static int setup_keys(void) { size_t mpk_size, seed_size, state_size, i; uint8_t *mpk, *seed, *state; ssize_t l; - int fd = -1, r, attr = 0; + int fd = -1, r; sd_id128_t machine, boot; char *p = NULL, *k = NULL; struct FSSHeader h; @@ -1389,13 +1389,9 @@ static int setup_keys(void) { /* Enable secure remove, exclusion from dump, synchronous * writing and in-place updating */ - if (ioctl(fd, FS_IOC_GETFLAGS, &attr) < 0) - log_warning_errno(errno, "FS_IOC_GETFLAGS failed: %m"); - - attr |= FS_SECRM_FL|FS_NODUMP_FL|FS_SYNC_FL|FS_NOCOW_FL; - - if (ioctl(fd, FS_IOC_SETFLAGS, &attr) < 0) - log_warning_errno(errno, "FS_IOC_SETFLAGS failed: %m"); + r = chattr_fd(fd, true, FS_SECRM_FL|FS_NODUMP_FL|FS_SYNC_FL|FS_NOCOW_FL); + if (r < 0) + log_warning_errno(errno, "Failed to set file attributes: %m"); zero(h); memcpy(h.signature, "KSHHRHLP", 8); @@ -1726,6 +1722,11 @@ int main(int argc, char *argv[]) { signal(SIGWINCH, columns_lines_cache_reset); sigbus_install(); + /* Increase max number of open files to 16K if we can, we + * might needs this when browsing journal files, which might + * be split up into many files. */ + setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384)); + if (arg_action == ACTION_NEW_ID128) { r = generate_new_id128(); goto finish;