X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournalctl.c;fp=src%2Fjournal%2Fjournalctl.c;h=62931f14c9bb71d7a886ff6bd66acbdde775b90a;hp=386e3505c044ed385f4049e54e126ff16321b86b;hb=11689d2a021d95a8447d938180e0962cd9439763;hpb=3c4230a5afb27faec2176d4642c0e2e145971b5c diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 386e3505c..62931f14c 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);