summaryrefslogtreecommitdiff
path: root/src/tmpfiles
Commit message (Collapse)AuthorAge
* tmpfiles, man: Add xattr support to tmpfilesMaciej Wereski2014-12-04
| | | | | | | | | | | | | | | | | | | | This patch makes it possible to set extended attributes on files created by tmpfiles. This can be especially used to set SMACK security labels on volatile files and directories. It is done by adding new line of type "t". Such line should contain attributes in Argument field, using following format: name=value All other fields are ignored. If value contains spaces, then it must be surrounded by quotation marks. User can also put quotation mark in value by escaping it with backslash. Example: D /var/run/cups - - - - t /var/run/cups - - - - security.SMACK64=printing
* treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1Lennart Poettering2014-11-28
|
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | 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-28
| | | | | | | | | | | 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.
* treewide: a few more log_*_errno + return simplificationsMichal Schmidt2014-11-28
| | | | The one in tmpfiles.c:create_item() even looks like it fixes a bug.
* treewide: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-28
| | | | | | | | | | | | | Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* Introduce CONF_DIRS_NULSTR helper to define standard conf dirsJosh Triplett2014-11-26
| | | | | | | Several different systemd tools define a nulstr containing a standard series of configuration file directories, in /etc, /run, /usr/local/lib, /usr/lib, and (#ifdef HAVE_SPLIT_USR) /lib. Factor that logic out into a new helper macro, CONF_DIRS_NULSTR.
* selinux: clean up selinux label function namingLennart Poettering2014-10-23
|
* mac: rename apis with mac_{selinux/smack}_ prefixWaLyong Cho2014-10-23
|
* tmpfiles: compare return against correct errnoDave Reisner2014-10-12
| | | | name_to_handle_at returns -EOPNOTSUPP, not -ENOTSUP.
* tmpfiles: use allocated buffer for pathZbigniew Jędrzejewski-Szmek2014-10-01
| | | | | | | Paths can in principle be longer then PATH_MAX, so simply allocate the buffer with malloc(). CID #1237773
* systemd-tmpfiles: Fix IGNORE_DIRECTORY_PATH age handlingRichard Weinberger2014-09-26
| | | | | | | | | | | | | | | | | If one has a config like: d /tmp 1777 root root - X /tmp/important_mount All files below /tmp/important_mount will be deleted as the /tmp/important_mount item will spuriously inherit a max age of 0 from /tmp. /tmp has a max age of 0 but age_set is (of course) false. This affects also the PrivateTmp feature of systemd. All tmp files of such services will be deleted unconditionally and can cause service failures and data loss. Fix this by checking ->age_set in the IGNORE_DIRECTORY_PATH logic.
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-15
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* tmpfiles: only execute chmod()/chown() when neededMichael Olbrich2014-08-18
| | | | | | | This avoids errors like this, when the paths are already there with the correct permissions and owner: chmod(/var/spool) failed: Read-only file system
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-03
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* tmpfiles: copy/link /usr/share/factory/ files when the source argument is ↵Kay Sievers2014-06-20
| | | | omitted
* tmpfiles: make sure "C" doesn't copy anything if the destination already existsLennart Poettering2014-06-19
| | | | | | | | | Previously it would recursively copy the entire tree in, and descend into subdirectories even if the destination already exists. Let's do what the documentation says and not do that. If files down the tree shall be copied too, they should get their own "C" lines.
* tmpfiles: do not fail when copying an empty directoryKay Sievers2014-06-19
|
* tmpfiles: create directories already with the right label, instead of ↵Lennart Poettering2014-06-18
| | | | creating them first, and relabeling them afterwards
* tmpfiles: w lines should allow following symlinksLennart Poettering2014-06-18
|
* tmpfiles: add "+" modifier support to b, c, p lines in addition to LLennart Poettering2014-06-18
|
* tmpfiles: add new "L+" command as stronger version of "L", that removes the ↵Lennart Poettering2014-06-16
| | | | | | | destination before creating a symlink Also, make use of this for mtab as long as mount insists on creating it even if we invoke it with "-n".
* tmpfiles: set up selinux label proeprly when creating fifosLennart Poettering2014-06-16
|
* tmpfiles: skip mknod() on -EPERM (device cgroup)Kay Sievers2014-06-13
|
* tmpfiles: minor modernizationsLennart Poettering2014-06-12
|
* tmpfiles: add ability to mask access mode by pre-existing access mode on ↵Lennart Poettering2014-06-11
| | | | | | | files/directories This way it makes a lot more sense to specify an access mode for "Z" lines.
* tmpfiles: remove unnecessary functionLennart Poettering2014-06-11
|
* tmpfiles: when processing lines, always process prefixes before suffixesLennart Poettering2014-06-11
| | | | | | | | | If two lines refer to paths that are suffix and prefix of each other, then always process the prefix first, the suffix second. In all other cases strictly process rules in the order they appear in the files. This makes creating /var/run as symlink to /run a lot more fun, since it is automatically created first.
* tmpfiles: static variables populated immediately from the command line ↵Lennart Poettering2014-06-11
| | | | should be prefixed with arg_
* tmpfiles: always recreate the most basic directory structure in /varLennart Poettering2014-06-11
| | | | | | Let's allow booting up with /var empty. Only create the most basic directories to get to a working directory structure and symlink set in /var.
* tmpfiles: get rid of "m" lines, make them redundant by "z"Lennart Poettering2014-06-10
| | | | | | | "m" so far has been a non-globbing version of "z". Since this makes it quite redundant, let's get rid of it. Remove "m" from the man pages, beef up "z" docs instead, and make "m" nothing more than a compatibility alias for "z".
* tmpfiles: add new "C" line for copying files or directoriesLennart Poettering2014-06-10
|
* tmpfiles: various modernizationsLennart Poettering2014-06-10
|
* label: when clearing selinux context, don't mangle errnoLennart Poettering2014-06-10
|
* implement a union to pad out file_handleDave Reisner2014-04-21
| | | | | | | | | | Cases where name_to_handle_at is used allocated the full struct to be MAX_HANDLE_SZ, and assigned this size to handle_bytes. This is wrong since handle_bytes should describe the length of the flexible array member and not the whole struct. Define a union type which includes sufficient padding to allow assignment of MAX_HANDLE_SZ to be correct.
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-18
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* shared: export is_dirZbigniew Jędrzejewski-Szmek2014-03-17
|
* tmpfiles: add --root option to operate on an alternate fs treeMichael Marineau2014-03-14
| | | | | This makes it possible to initialize or cleanup an arbitrary filesystem hierarchy in the same way that it would be during system boot.
* shared: add root argument to search_and_fopenMichael Marineau2014-03-14
| | | | | | | This adds the same root argument to search_and_fopen that conf_files_list already has. Tools that use those two functions as a pair can now be easily modified to load configuration files from an alternate root filesystem tree.
* tmpfiles: simplificationLennart Poettering2014-02-19
|
* tmpfiles: fix memory leak of exclude_prefixesZbigniew Jędrzejewski-Szmek2014-01-30
| | | | Missed in 5c795114.
* tmpfiles: don't allow label_fix to print ENOENT when we want to ignore itLukas Nykryn2014-01-09
|
* tmpfiles: rename --unsafe to --bootZbigniew Jędrzejewski-Szmek2013-12-30
| | | | | As suggested by Kay, it is better to describe what is done, not what might happen.
* tmpfiles: introduce the concept of unsafe operationsZbigniew Jędrzejewski-Szmek2013-12-24
| | | | | | | | | | | | | | | | | | | | | | | | Various operations done by systemd-tmpfiles may only be safely done at boot (e.g. removal of X lockfiles in /tmp, creation of /run/nologin). Other operations may be done at any point in time (e.g. setting the ownership on /{run,var}/log/journal). This distinction is largely orthogonal to the type of operation. A new switch --unsafe is added, and operations which should only be executed during bootup are marked with an exclamation mark in the configuration files. systemd-tmpfiles.service is modified to use this switch, and guards are added so it is hard to re-start it by mistake. If we install a new version of systemd, we actually want to enforce some changes to tmpfiles configuration immediately. This should now be possible to do safely, so distribution packages can be modified to execute the "safe" subset at package installation time. /run/nologin creation is split out into a separate service, to make it easy to override. https://bugzilla.redhat.com/show_bug.cgi?id=1043212 https://bugzilla.redhat.com/show_bug.cgi?id=1045849
* log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering2013-12-24
| | | | including it in the log strings
* tmpfiles: replace readdir_r with readdirFlorian Weimer2013-12-21
|
* clients: unify how we invoke getopt_long()Lennart Poettering2013-11-06
| | | | | Among other things this makes sure we always expose a --version command and show it in the help texts.
* build-sys: use -Og instead of -O0 to catch warningsKay Sievers2013-10-21
| | | | | | | | | | | | | | | | | | | | | | | | $ touch src/core/dbus.c; make CFLAGS=-O0 make --no-print-directory all-recursive Making all in . CC src/core/libsystemd_core_la-dbus.lo CCLD libsystemd-core.la $ touch src/core/dbus.c; make CFLAGS=-Og make --no-print-directory all-recursive Making all in . CC src/core/libsystemd_core_la-dbus.lo src/core/dbus.c: In function 'init_registered_system_bus': src/core/dbus.c:798:18: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized] dbus_free(id); ^ CCLD libsystemd-core.la -Og Optimize debugging experience. -Og enables optimizations that do not interfere with debugging. It should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience.