int r;
char *type;
unsigned t;
- Virtualization v;
+ int v;
v = detect_virtualization(NULL);
return write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]);
}
-static int context_write_data_other(Context *c) {
+static int context_write_data_machine_info(Context *c) {
static const char * const name[_PROP_MAX] = {
[PROP_PRETTY_HOSTNAME] = "PRETTY_HOSTNAME",
if (r < 0 && r != -ENOENT)
return r;
- for (p = 2; p < _PROP_MAX; p++) {
+ for (p = PROP_PRETTY_HOSTNAME; p <= PROP_CHASSIS; p++) {
char *t, **u;
assert(name[p]);
c->data[prop] = h;
}
- r = context_write_data_other(c);
+ r = context_write_data_machine_info(c);
if (r < 0) {
log_error("Failed to write machine info: %s", strerror(-r));
return sd_bus_error_set_errnof(error, r, "Failed to write machine info: %s", strerror(-r));
r = context_read_data(&context);
if (r < 0) {
- log_error("Failed to read timezone data: %s", strerror(-r));
+ log_error("Failed to read hostname and machine information: %s", strerror(-r));
goto finish;
}
- r = bus_event_loop_with_idle(event, bus, "org.freedesktop.hostname1", DEFAULT_EXIT_USEC);
+ r = bus_event_loop_with_idle(event, bus, "org.freedesktop.hostname1", DEFAULT_EXIT_USEC, NULL, NULL);
if (r < 0) {
log_error("Failed to run event loop: %s", strerror(-r));
goto finish;