diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index 9aa298c654..2ea3f6c850 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -835,7 +835,7 @@ static int create_session_message( if (!avoid_pidfd) { pidfd = pidfd_open(getpid_cached(), 0); - if (pidfd < 0 && !ERRNO_IS_NOT_SUPPORTED(errno)) + if (pidfd < 0 && !ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno)) return -errno; } diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c index e81afee058..999e08b16e 100644 --- a/src/systemctl/systemctl-show.c +++ b/src/systemctl/systemctl-show.c @@ -2261,7 +2261,7 @@ static int get_unit_dbus_path_by_pid( * sends the numeric PID. */ pidfd = pidfd_open(pid, 0); - if (pidfd < 0 && ERRNO_IS_NOT_SUPPORTED(errno)) + if (pidfd < 0 && ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno)) return get_unit_dbus_path_by_pid_fallback(bus, pid, ret_path, ret_unit); if (pidfd < 0) return log_error_errno(errno, "Failed to open PID %"PRIu32": %m", pid);