summaryrefslogtreecommitdiffstats
path: root/src/shared/base-filesystem.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shared: be friendly to EROFS imagesLennart Poettering2019-04-031-8/+14
| | | | | | There are environments where /lib might not be necessary (think: statically compiled portable service binary), hence don't insist on it if the image is read-only.
* shared: path_join() is your friendLennart Poettering2019-04-031-1/+2
|
* shared: no need to initialize variableLennart Poettering2019-04-031-1/+1
|
* util: split out nulstr related stuff to nulstr-util.[ch]Lennart Poettering2019-03-141-1/+1
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: be more careful with the type of array sizesLennart Poettering2018-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we were a bit sloppy with the index and size types of arrays, we'd regularly use unsigned. While I don't think this ever resulted in real issues I think we should be more careful there and follow a stricter regime: unless there's a strong reason not to use size_t for array sizes and indexes, size_t it should be. Any allocations we do ultimately will use size_t anyway, and converting forth and back between unsigned and size_t will always be a source of problems. Note that on 32bit machines "unsigned" and "size_t" are equivalent, and on 64bit machines our arrays shouldn't grow that large anyway, and if they do we have a problem, however that kind of overly large allocation we have protections for usually, but for overflows we do not have that so much, hence let's add it. So yeah, it's a story of the current code being already "good enough", but I think some extra type hygiene is better. This patch tries to be comprehensive, but it probably isn't and I missed a few cases. But I guess we can cover that later as we notice it. Among smaller fixes, this changes: 1. strv_length()' return type becomes size_t 2. the unit file changes array size becomes size_t 3. DNS answer and query array sizes become size_t Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=76745
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* Merge pull request #5420 from OpenDZ/tixxdz/namespace-fixes-v2Lennart Poettering2017-05-091-0/+3
|\ | | | | Namespace: RootImage= RootDirectory= and MountAPIVFS fixes
| * namespace: create base-filesystem directories if RootImage= or ↵Djalal Harouni2017-03-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RootDirectory= are set When a service is started with its own file system image, always try to create the base-filesystem directories that are needed. This implicitly covers the directories handled by MountAPIVFS= {/proc|/sys|/dev}. Mount protections or MountAPIVFS= mounts were never applied if we changed the root directory and the related paths were not present under the new root. The mounts were silently. Fix this by creating those directories if they are missing. Closes https://github.com/systemd/systemd/issues/5488
* | base-filesystem: skip fchownat() if the previous mkdirat() on same path ↵Djalal Harouni2017-03-161-0/+2
|/ | | | | | | | | failed (#5548) If we are working on a path that was marked to be ignored on errors, and the mkdirat() fails then add a continue statement and skip fchownat() call. This avoids the case where UID/GID are valid and we run fchownat() on non existent path which will fail hard even on paths that we want to ignore in case of errors.
* shared: use uid_is_valid() for checking validity of UIDsLennart Poettering2016-12-201-1/+1
|
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2016-10-231-1/+1
| | | | | | | | | | | | | 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.
* 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.
* shared: include what we useThomas Hindoe Paaboel Andersen2015-12-061-0/+3
| | | | | The next step of a general cleanup of our includes. This one mostly adds missing includes but there are a few removals as well.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* user-util: move UID/GID related macros from macro.h to user-util.hLennart Poettering2015-10-271-0/+1
|
* util-lib: split out umask-related code to umask-util.hLennart Poettering2015-10-271-2/+3
|
* 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-2/+3
| | | | | | | | | | | | | | 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.
* base-fs: consider inability to create /root non-fatalLennart Poettering2015-09-301-3/+9
| | | | Fixes #1414
* nspawn: finish user namespace supportLennart Poettering2015-05-211-1/+15
|
* fix gcc warnings about uninitialized variablesHarald Hoyer2015-03-271-1/+1
| | | | | | | | | | | | | like: src/shared/install.c: In function ‘unit_file_lookup_state’: src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] return r < 0 ? r : state; ^ src/shared/install.c:1796:13: note: ‘r’ was declared here int r; ^
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-5/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* treewide: another round of simplificationsMichal Schmidt2014-11-281-12/+6
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-3/+3
| | | | | | | | | | | 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.
* base-file-system: always generate error messages locallyLennart Poettering2014-09-031-3/+4
| | | | | | | | Functions either should generate error messages for everything they do themselves, or for nothing and let the caller do it. But they certainly shouldn't generate errors for some messages but not for others. Since the function in this case is one that generates messages on its own, it really should do that for everything, not just for some things, hence.
* base_filesystem_create: do not try to create "/root" if it existsHarald Hoyer2014-09-031-3/+3
| | | | | | | | | | | The check, if the directory/file already exists is only executed, if there is a symlink target specified. In case of "/root", there is none, so it is unconditionally tried to create the directory. In case of a readonly filesystem, errno != EEXIST, but errno == EROFS, so base_filesystem_create() and switch_root does not succeed. This patch checks for existance not only in the symlink case.
* base-filesystem.c: terminate string array elements with \0Harald Hoyer2014-07-071-5/+6
| | | | | NULSTR_FOREACH() looks for a terminating zero and the element also needs one.
* base-filesystem: avoid all searching if the link already existsKay Sievers2014-07-011-0/+3
|
* base-filesystem: explicitely check existence of the platform's ABI dynamic ↵Kay Sievers2014-07-011-5/+18
| | | | loader
* base-filesystem: create /lib64 symlink to libdir /usr directoryKay Sievers2014-07-011-7/+21
|
* nspawn: create essential base directories at system bootupKay Sievers2014-06-241-0/+82
This allows us to bootup a rootfs with a /usr directory only.