udevadm: drop pointless must_be_root() checks

Checking if we are root on the client side is generally pointless, since the
privileged operation will fail anyway and we can than log what precisly went
wrong.

A check like this makes sense only if:
- we need to do some expensive unprivileged operation before attempting the
  privileged operation, and the check allows us avoid wasting resources.
- the privileged operation would fail but in an unclear way.

Neither of those cases applies here.

This fixes calls like 'udevadm control -h' as unprivileged user.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-05-08 11:51:51 +02:00
parent 717e8eda77
commit 569ad251ad
2 changed files with 0 additions and 10 deletions
-4
View File
@@ -73,10 +73,6 @@ int control_main(int argc, char *argv[], void *userdata) {
{}
};
r = must_be_root();
if (r < 0)
return r;
if (running_in_chroot() > 0) {
log_info("Running in chroot, ignoring request.");
return 0;
-6
View File
@@ -301,12 +301,6 @@ int trigger_main(int argc, char *argv[], void *userdata) {
}
}
if (!arg_dry_run || ping) {
r = must_be_root();
if (r < 0)
return r;
}
if (ping) {
_cleanup_(udev_ctrl_unrefp) struct udev_ctrl *uctrl = NULL;