#include "bus-util.h"
#include "bus-error.h"
#include "bus-errors.h"
-#include "virt.h"
#include "fileio.h"
#include "udev-util.h"
static bool arg_show_progress = false;
static void start_target(const char *target) {
- _cleanup_bus_unref_ sd_bus *bus = NULL;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_bus_unref_ sd_bus *bus = NULL;
int r;
assert(target);
- r = bus_connect_system(&bus);
+ r = bus_open_system_systemd(&bus);
if (r < 0) {
log_error("Failed to get D-Bus connection: %s", strerror(-r));
return;
&error,
NULL,
"sss", "basic.target", target, "replace");
- if (r < 0) {
- /* Don't print a warning if we aren't called during
- * startup */
- if (!sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB))
- log_error("Failed to start unit: %s", bus_error_message(&error, -r));
- }
-
- return;
+ /* Don't print a warning if we aren't called during startup */
+ if (r < 0 && !sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB))
+ log_error("Failed to start unit: %s", bus_error_message(&error, -r));
}
static int parse_proc_cmdline(void) {
char *line, *w, *state;
- int r;
size_t l;
+ int r;
- if (detect_container(NULL) > 0)
- return 0;
-
- r = read_one_line_file("/proc/cmdline", &line);
- if (r < 0) {
+ r = proc_cmdline(&line);
+ if (r < 0)
log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
+ if (r <= 0)
return 0;
- }
FOREACH_WORD_QUOTED(w, l, line, state) {