summaryrefslogtreecommitdiffstats
path: root/src/tmpfiles/tmpfiles.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* exec-util,conf-files: skip non-executable files in execute_directories()Lennart Poettering2017-09-131-1/+1
| | | | Fixes: #6787
* tmpfiles: silently ignore any path that passes through autofs (#6506)NeilBrown2017-09-041-0/+3
| | | | | | | | | | | | | | | | If a path passes though an autofs filesystem, then accessing the path might trigger and automount. As systemd-tmpfiles is run before the network is up, and as automounts are often used for networked filesystems, this can cause a deadlock. So chase_symlinks is enhance to accept a new flag which tells it to check for autofs, and return -EREMOTE if autofs is found. tmpfiles is changed to check just before acting on a path so that it can avoid autofs even if a symlink was created earlier by tmpfiles that would send this path through an autofs. This fixes a deadlock that happens when /home is listed in /etc/fstab as x-systemd.automount for an NFS directory.
* tmpfiles: with "e" don't attempt to set permissions when file doesn't exist ↵Michal Sekletar2017-08-311-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | (#6682) tmpfiles.d option "e" when run through systemd-tmpfiles --create should apply configured permissions (uid,gid) only to already existing files. When file doesn't exist we bail out with error. Instead we should silently ignore non-existing files. $ useradd test $ cat /etc/tmpfiles.d/foobar.conf e /tmp/test - test test 1d $ ls -l /tmp/test ls: cannot access '/tmp/test': No such file or directory Before: $ systemd-tmpfiles --create /etc/tmpfiles.d/foobar.conf Adjusting owner and mode for /tmp/test failed: No such file or directory $ echo $? 1 After: $ systemd-tmpfiles --create /etc/tmpfiles.d/foobar.conf $ echo $? 0
* tmpfiles: Allow create symlink on directories (#6039)William Douglas2017-08-091-0/+9
| | | | | | Currently if tmpfiles is run with force on symlink creation but there already exists a directory at that location, the creation will fail. This change updates the behavior to remove the directory with rm_fr and then attempts to create the symlink again.
* tree-wide: when %m is used in log_*, always specify errno explicitlyZbigniew Jędrzejewski-Szmek2017-05-191-4/+3
| | | | | | | | All those uses were correct, but I think it's better to be explicit. Using implicit errno is too error prone, and with this change we can require (in the sense of a style guideline) that the code is always specified. Helpful query: git grep -n -P 'log_[^s][a-z]+\(.*%m'
* tmpfiles: use safe_glob()Zbigniew Jędrzejewski-Szmek2017-04-271-8/+3
| | | | | | | | | | | | This filters out "." and ".." from glob results. Fixes #5655 and #5644. Any judgements on whether the path is "safe" are removed. We will not remove "/" under any name (including "/../" and such), but we will remove stuff that is specified using paths that include "//", "/./" and "/../". Such paths can be created when joining strings automatically, or for other reasons, and people generally know what ".." and "." is. Tests are added to make sure that the helper functions behave as expected.
* tmpfiles: downgrade error message when operation is not supported (#5692)Yu Watanabe2017-04-101-1/+1
| | | Fixes #5607
* Fix missing space in comments (#5439)AsciiWolf2017-02-241-1/+1
|
* machined: when copying files from/to userns containers chown to rootLennart Poettering2017-02-171-1/+1
| | | | | | | | This changes the file copy logic of machined to set the UID/GID of all copied files to 0 if the host and container do not share the same user namespace. Fixes: #4078
* copy: change the various copy_xyz() calls to take a unified flags parameterLennart Poettering2017-02-171-1/+1
| | | | | | | | This adds a unified "copy_flags" parameter to all copy_xyz() function calls, replacing the various boolean flags so far used. This should make many invocations more readable as it is clear what behaviour is precisely requested. This also prepares ground for adding support for more modes later on.
* fs-util: unify code we use to check if dirent's d_name is "." or ".."Lennart Poettering2017-02-021-4/+2
| | | | | We use different idioms at different places. Let's replace this is the one true new idiom, that is even a bit faster...
* tmpfiles: improve error message for chown()/chmod() failures (#4969)Lennart Poettering2016-12-291-2/+2
| | | | | Let's make the error message less confusing here. Fixes: #4954
* tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853)Reverend Homer2016-12-091-11/+4
|
* Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2016-11-071-1/+1
| | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2016-10-231-2/+2
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* Use "return log_error_errno" in more places"Zbigniew Jędrzejewski-Szmek2016-07-231-3/+2
|
* tmpfiles: make sure to always initialize "r" correctly.Lennart Poettering2016-06-211-1/+1
|
* Fix FS_EXTENT_FL description (#3381)kpengboy2016-05-291-1/+1
|
* tmpfiles: add new 'e' action which cleans up a dir without creating itZbigniew Jędrzejewski-Szmek2016-04-201-41/+15
| | | | | | | | I wanted to add a config line that would empty a directory without creating it if doesn't exist. Existing actions don't allow this. v2: properly add 'e' to needs_glob() and takes_ownership()
* tmpfiles: shorten some long error messagesZbigniew Jędrzejewski-Szmek2016-04-201-3/+3
| | | | Also don't print %m when the message already contains all the info.
* tmpfiles: interpret "-" as stdinZbigniew Jędrzejewski-Szmek2016-04-201-9/+17
|
* tree-wide: use SET_FLAG() macro to make code more clearAlexander Kuleshov2016-03-051-4/+1
|
* Merge pull request #2781 from keszybz/selinux-and-warningsLennart Poettering2016-03-031-1/+1
|\ | | | | Selinux loading fix and warning cleanups
| * selinux: always try to load the full selinux dbZbigniew Jędrzejewski-Szmek2016-03-021-1/+1
| | | | | | | | | | https://github.com/systemd/systemd/pull/2508#issuecomment-190901170 Maybe fixes https://bugzilla.redhat.com/show_bug.cgi?id=1308771.
* | tree-wide: no need to pass excess flags to open()/openat() if O_PATH is passedAlexander Kuleshov2016-03-011-2/+2
|/ | | | | | | | | | As described in the documentation: When O_PATH is specified in flags, flag bits other than O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW are ignored. So, we can remove unnecessary flags in a case when O_PATH is passed to the open() or openat().
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tmpfiles: don't skip path_set_perms on errorEvgeny Vereshchagin2016-02-011-13/+10
| | | | fixes #2196
* tree-wide: check if errno is greater than zero (2)Zbigniew Jędrzejewski-Szmek2016-01-131-1/+1
| | | | | Compare errno with zero in a way that tells gcc that (if the condition is true) errno is positive.
* tmpfiles: create subvolumes for "v", "q", and "Q" only if / is a subvolumeLennart Poettering2015-11-161-2/+22
| | | | | | | | | | | | | | | | It's not a good idea to create subvolumes for parts of the OS tree (such as /home, or /var) if the root directory is not a subvolume too. We shouldn't assume control of "heavier" objects such as subvolumes, if the originating object (the root directory) is a "light-weight" object, i.e. a plain directory. Effectively this means that chroot() environments that are run on a plain directory do not have to deal with problems around systemd creating subvolumes that cannot be removed with a simple "rm" anymore. However, if the chroot manager creates a proper subvolume for such an environment it will also get further subvolumes placed in there, under the assumption that the manager understands the concept of subvolumes in that case.
* tmpfiles: don't consider it a problem if quota is not enabled on btrfsLennart Poettering2015-11-101-0/+4
| | | | | | | If quota is not enabled on a btrfs file system, accept that, and only log a debug message, but do not consider this a reason for failure. Fixes: #1809
* defs: rework CONF_DIRS_NULSTR() macroLennart Poettering2015-11-101-1/+1
| | | | | | | | | | | | The macro is generically useful for putting together search paths, hence let's make it truly generic, by dropping the implicit ".d" appending it does, and leave that to the caller. Also rename it from CONF_DIRS_NULSTR() to CONF_PATHS_NULSTR(), since it's not strictly about dirs that way, but any kind of file system path. Also, mark CONF_DIR_SPLIT_USR() as internal macro by renaming it to _CONF_PATHS_SPLIT_USR() so that the leading underscore indicates that it's internal.
* util-lib: move CONF_DIRS_NULSTR definition to def.hLennart Poettering2015-11-031-0/+1
| | | | | | After all, this is not some compiler or C magic, but something very specific to how systemd works, hence let's move it into def.h, and out of macro.h
* mount-util: move fstype_is_network() and name_to_handle_at() definitions overLennart Poettering2015-10-271-0/+1
|
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out globbing related calls into glob-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out printf() helpers to stdio-util.hLennart Poettering2015-10-271-0/+1
|
* src/basic: rename audit.[ch] → audit-util.[ch] and capability.[ch] → ↵Lennart Poettering2015-10-271-1/+1
| | | | | | | | | capability-util.[ch] The files are named too generically, so that they might conflict with the upstream project headers. Hence, let's add a "-util" suffix, to clarify that this are just our utility headers and not any official upstream headers.
* util-lib: split out umask-related code to umask-util.hLennart Poettering2015-10-271-0/+1
|
* util-lib: move string table stuff into its own string-table.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move a number of fs operations into fs-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out file attribute calls to chattr-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move more file I/O related calls into fileio.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out user/group/uid/gid calls into user-util.[ch]Lennart Poettering2015-10-261-0/+1
|
* util-lib: split out IO related calls to io-util.[ch]Lennart Poettering2015-10-261-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-0/+1
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* util: split out escaping code into escape.[ch]Lennart Poettering2015-10-241-0/+1
| | | | This really deserves its own file, given how much code this is now.
* path-util: unify how we process paths specified on the command lineLennart Poettering2015-10-241-5/+2
| | | | | Let's introduce a common function that makes relative paths absolute and warns about any errors while doing so.