X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftmpfiles.c;h=984eaf0de192538f0209fa3880a8b03ab8f3f86d;hb=26742b3fd8776c6c64e3c1035adc2599ddeb76d1;hp=1ad5a01eab9eaf3abd32c8fa4d7340287c34498b;hpb=abe35cc2b7921891cc56cd8d402e8f7d1ef48d39;p=elogind.git diff --git a/src/tmpfiles.c b/src/tmpfiles.c index 1ad5a01ea..984eaf0de 100644 --- a/src/tmpfiles.c +++ b/src/tmpfiles.c @@ -149,7 +149,7 @@ static int dir_cleanup( DIR *sub_dir; int q; - sub_dir = xopendirat(dirfd(d), dent->d_name); + sub_dir = xopendirat(dirfd(d), dent->d_name, O_NOFOLLOW); if (sub_dir == NULL) { if (errno != ENOENT) { log_error("opendir(%s/%s) failed: %m", p, dent->d_name); @@ -182,6 +182,13 @@ static int dir_cleanup( } } else { + /* Skip files for which the sticky bit is + * set. These are semantics we define, and are + * unknown elsewhere. See XDG_RUNTIME_DIR + * specification for details. */ + if (s.st_mode & S_ISVTX) + continue; + if (mountpoint) { if (streq(dent->d_name, ".journal") && s.st_uid == 0) @@ -584,6 +591,12 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, cons } if ((r = hashmap_put(items, i->path, i)) < 0) { + if (r == -EEXIST) { + log_warning("Two or more conflicting lines for %s configured, ignoring.", i->path); + r = 0; + goto finish; + } + log_error("Failed to insert item %s: %s", i->path, strerror(-r)); goto finish; }