pulse-server: show warning about snap kernel features only once

Don't spam the warning about kernel missing features required for snap
on every pulseaudio connection, but instead show it only once, as the
situation is not going to improve.
This commit is contained in:
Pauli Virtanen 2024-05-01 13:14:51 +03:00
parent d80989ab56
commit 44d958d397

View file

@ -66,9 +66,15 @@ pw_sandbox_access_t pw_snap_get_audio_permissions(struct client *client, int fd,
return PW_SANDBOX_ACCESS_NOT_A_SANDBOX;
}
if (errno == ENOPROTOOPT) {
static bool warned;
// if fine grained unix mediation isn't available, we can't know if this is a snap or
// not, so we have no choice but give full access
pw_log_warn("snap_get_audio_permissions: kernel lacks 'fine grained unix mediation'; snap audio permissions won't be honored.");
if (!warned) {
pw_log_warn("snap_get_audio_permissions: kernel lacks 'fine grained unix mediation'; "
"snap audio permissions won't be honored.");
warned = true;
}
return PW_SANDBOX_ACCESS_NOT_A_SANDBOX;
}
pw_log_warn("snap_get_audio_permissions: failed to get the AppArmor info: %s.", strerror(errno));