summaryrefslogtreecommitdiff
path: root/src/shared/switch-root.c
AgeCommit message (Collapse)Author
2016-12-21shared: rework switch_root() codeLennart Poettering
Let's follow symlinks before invoking mount() on arbitrary paths, so that we won't get confused if directories are prepared with absolute symlinks. Use FOREACH_STRING() instead of NULSTR_FOREACH() as it is more readable. Don't use snprintf() for concatenating strings, let chase_symlinks() to that. Replace homegrown mount check with path_is_mount_point(). Also, change the behaviour when we encounter this: instead of unmounting the old mount point, simply leave it around and don't replace it, so that initrds can mount stuff there with different settings than we would apply. This is in-line with how we handle automatic mounts in nspawn for example. Use umount_recursive() instead of a simple umount2() for unmounting the old root, so that we actually cover really all mounts, not just the top-level one.
2016-11-02Do not raise in switch root if paths are too longZbigniew Jędrzejewski-Szmek
If we encounter the (unlikely) situation where the combined path to the new root and a path to a mount to be moved together exceed maximum path length, we shouldn't crash, but fail this path instead.
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2016-01-12tree-wide: use xsprintf() where applicableDaniel Mack
Also add a coccinelle receipt to help with such transitions.
2015-12-06shared: include what we useThomas Hindoe Paaboel Andersen
The next step of a general cleanup of our includes. This one mostly adds missing includes but there are a few removals as well.
2015-10-27user-util: move UID/GID related macros from macro.h to user-util.hLennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
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.
2015-05-21nspawn: finish user namespace supportLennart Poettering
2015-04-06util: rework rm_rf() logicLennart Poettering
- Move to its own file rm-rf.c - Change parameters into a single flags parameter - Remove "honour sticky" logic, it's unused these days
2015-02-03util: rework strappenda(), and rename it strjoina()Lennart Poettering
After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
2015-02-01Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek
If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c.
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-06switch-root: explain why we don't care about base_filesystem_create() failingLennart Poettering
2014-11-06switch_root: do not fail, if base_filesystem_create() failedHarald Hoyer
Not all switch roots are like base_filesystem_create() wants them to look like. They might even boot, if they are RO and don't have the FS layout. Just ignore the error and switch_root nevertheless. base_filesystem_create() should have logged, what went wrong.
2014-10-17systemd: continue switch-root even if umount failsZbigniew Jędrzejewski-Szmek
Leaving the old root around seems better than aborting the switch.
2014-08-28use the switch_root function in shutdownHarald Hoyer
removes code duplication also move switch-root to shared