summaryrefslogtreecommitdiff
path: root/src/core/machine-id-setup.c
AgeCommit message (Collapse)Author
2014-12-09treewide: sanitize loop_writeZbigniew Jędrzejewski-Szmek
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.
2014-12-03machine-id-setup: add a machine_id_commit call to commit on disk a transient ↵Didier Roche
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.
2014-12-03machine-id-setup: casting const away is ugly, let's not do it if there's no ↵Lennart Poettering
reason to
2014-12-03machine-id-setup: Factorize some machine-id-setup functions to be reusedDidier Roche
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-28treewide: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
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().
2014-11-01core: improve error message when machine id is missingJan Synacek
2014-08-20machine-id-setup: don't try to read UUID from VM/container manager if we ↵Lennart Poettering
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.
2014-07-31Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek
In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
2014-06-24nspawn: create essential base directories at system bootupKay Sievers
This allows us to bootup a rootfs with a /usr directory only.
2014-06-17machine-id-setup: allow passing NULL as function argument, for simplicityLennart Poettering
2014-06-10machine-id-setup: fix array size of parametersLennart Poettering
Not that it really would have any effect on the generated code, but let's not confuse people...
2014-04-28machine-id: only look into KVM uuid when we are not running in aLennart Poettering
container
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
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.
2014-03-14machine-id-setup: use path_kill_slashes and modernizationsZbigniew Jędrzejewski-Szmek
2014-03-14machine-id: add --root option to operate on an alternate fs treeGreg KH
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]
2013-10-21build-sys: use -Og instead of -O0 to catch warningsKay Sievers
$ 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.
2013-04-30id128: when taking user input for a 128bit ID, validate syntaxLennart Poettering
Also, always accept both our simple hexdump syntax and UUID syntax.
2013-04-08machine-id: fix missing initializationsystemd/v201Lennart Poettering
2013-04-04util: add a bit of syntactic sugar to run short code fragments with a ↵Lennart Poettering
different umask
2013-04-03util: rename write_one_line_file() to write_string_file()Lennart Poettering
You can write much more than just one line with this call (and we frequently do), so let's correct the naming.
2013-03-31nspawn, machine-id-setup: warn if read-only mount call failsZbigniew Jędrzejewski-Szmek
They are not crucial, but they shouldn't fail.
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
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
2012-08-13machine-id: properly mount transient machine ID read-onlyLennart Poettering
2012-04-22machine-id: fix spellingLennart Poettering
2012-04-22util: unify getenv() logic for other PIDLennart Poettering
2012-04-12build-sys: move *-setup out of shared to avoid selinux being pulled inLennart Poettering