summaryrefslogtreecommitdiff
path: root/src/core/machine-id-setup.c
Commit message (Collapse)AuthorAge
* machine-id-setup: simplificationsLennart Poettering2015-03-10
|
* Introduce loop_read_exact helperZbigniew Jędrzejewski-Szmek2015-03-09
| | | | | | | | Usually when using loop_read(), we want to read the full buffer. Add a helper that mirrors loop_write(), and returns 0 when full buffer was read, and an error otherwise. Use -ENODATA for the short read, to distinguish it from a read error.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | 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.
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | 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.
* tree-wide: spelling fixesVeres Lajos2014-12-30
| | | | | | | https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
* treewide: sanitize loop_writeZbigniew Jędrzejewski-Szmek2014-12-09
| | | | | | | loop_write() didn't follow the usual systemd rules and returned status partially in errno and required extensive checks from callers. Some of the callers dealt with this properly, but many did not, treating partial writes as successful. Simplify things by conforming to usual rules.
* machine-id-setup: add a machine_id_commit call to commit on disk a transient ↵Didier Roche2014-12-03
| | | | | | | | | machine-id If /etc was read only at boot time with an empty /etc/machine-id, the latter will be mounted as a tmpfs and get reset at each boot. If the system becomes rw later, this functionality enables to commit in a race-free manner the transient machine-id to disk.
* machine-id-setup: casting const away is ugly, let's not do it if there's no ↵Lennart Poettering2014-12-03
| | | | reason to
* machine-id-setup: Factorize some machine-id-setup functions to be reusedDidier Roche2014-12-03
|
* 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: more log_*_errno + return simplificationsMichal Schmidt2014-11-28
|
* 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().
* core: improve error message when machine id is missingJan Synacek2014-11-01
|
* machine-id-setup: don't try to read UUID from VM/container manager if we ↵Lennart Poettering2014-08-20
| | | | | | | operate on a root directory that's not / This should make sure no UUID from the host systemd-machine-id-setup is running on leaks onto a disk image that is provisioned with the tool.
* Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
* nspawn: create essential base directories at system bootupKay Sievers2014-06-24
| | | | This allows us to bootup a rootfs with a /usr directory only.
* machine-id-setup: allow passing NULL as function argument, for simplicityLennart Poettering2014-06-17
|
* machine-id-setup: fix array size of parametersLennart Poettering2014-06-10
| | | | | Not that it really would have any effect on the generated code, but let's not confuse people...
* machine-id: only look into KVM uuid when we are not running in aLennart Poettering2014-04-28
| | | | container
* 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.
* machine-id-setup: use path_kill_slashes and modernizationsZbigniew Jędrzejewski-Szmek2014-03-14
|
* machine-id: add --root option to operate on an alternate fs treeGreg KH2014-03-14
| | | | | | | | | This makes it possible to initialize the /etc/machine-id file on an arbitrary filesystem hierarchy. This helps systems that wish to run this at image creation time in a subdirectory, or from initramfs before pivot-root is called. [tomegun: converted to using _cleanup_free_ macros]
* 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.
* id128: when taking user input for a 128bit ID, validate syntaxLennart Poettering2013-04-30
| | | | Also, always accept both our simple hexdump syntax and UUID syntax.
* machine-id: fix missing initializationLennart Poettering2013-04-08
|
* util: add a bit of syntactic sugar to run short code fragments with a ↵Lennart Poettering2013-04-04
| | | | different umask
* util: rename write_one_line_file() to write_string_file()Lennart Poettering2013-04-03
| | | | | You can write much more than just one line with this call (and we frequently do), so let's correct the naming.
* nspawn, machine-id-setup: warn if read-only mount call failsZbigniew Jędrzejewski-Szmek2013-03-31
| | | | They are not crucial, but they shouldn't fail.
* honor SELinux labels, when creating and writing config filesHarald Hoyer2013-02-14
| | | | | | | Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
* machine-id: properly mount transient machine ID read-onlyLennart Poettering2012-08-13
|
* machine-id: fix spellingLennart Poettering2012-04-22
|
* util: unify getenv() logic for other PIDLennart Poettering2012-04-22
|
* build-sys: move *-setup out of shared to avoid selinux being pulled inLennart Poettering2012-04-12