diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-10-07 23:03:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-10-07 23:03:07 +0200 |
commit | f4b4781191e8edfb5690e4447166e3ba7bcb48f5 (patch) | |
tree | ba7537ab065a42c68352672e59223d8c3024521b /src/util.c | |
parent | 260a2be45522f03ce8d8aca38e471d7b0882ff05 (diff) |
journal: split user logs into their own journal files
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index 99737e4e63..a3cfe864b6 100644 --- a/src/util.c +++ b/src/util.c @@ -3529,6 +3529,22 @@ int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) { return 0; } +int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) { + assert(fd >= 0); + + /* Under the assumption that we are running privileged we + * first change the access mode and only then hand out + * ownership to avoid a window where access is too open. */ + + if (fchmod(fd, mode) < 0) + return -errno; + + if (fchown(fd, uid, gid) < 0) + return -errno; + + return 0; +} + cpu_set_t* cpu_set_malloc(unsigned *ncpus) { cpu_set_t *r; unsigned n = 1024; |