mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
Couple small cleanups (#35593)
This commit is contained in:
commit
8a1068931d
@ -123,14 +123,14 @@ static int run(int argc, char *argv[]) {
|
||||
|
||||
log_setup();
|
||||
|
||||
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
|
||||
|
||||
if (!arg_doit) {
|
||||
log_info("Checking battery status and AC power existence is disabled by the kernel command line, skipping execution.");
|
||||
return 0;
|
||||
|
@ -224,15 +224,11 @@ static int run(int argc, char *argv[]) {
|
||||
dissected = dissected_image_unref(dissected);
|
||||
#endif
|
||||
|
||||
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0) {
|
||||
log_tests_skipped("not running privileged");
|
||||
return 0;
|
||||
}
|
||||
if (geteuid() != 0 || have_effective_cap(CAP_SYS_ADMIN) <= 0)
|
||||
return log_tests_skipped("not running privileged");
|
||||
|
||||
if (detect_container() > 0) {
|
||||
log_tests_skipped("Test not supported in a container, requires udev/uevent notifications");
|
||||
return 0;
|
||||
}
|
||||
if (detect_container() > 0)
|
||||
return log_tests_skipped("Test not supported in a container, requires udev/uevent notifications");
|
||||
|
||||
assert_se(loop_device_make(fd, O_RDWR, 0, UINT64_MAX, 0, LO_FLAGS_PARTSCAN, LOCK_EX, &loop) >= 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user