31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
# P2-misc-daemon-fixes.patch
|
|
#
|
|
# Various daemon error handling and robustness fixes:
|
|
# graceful degradation when audio hardware is absent,
|
|
# zerod argument handling and request loop resilience.
|
|
#
|
|
# Covers:
|
|
# - audiod/main.rs: handle ENODEV when no audio hardware present
|
|
# - zerod/main.rs: derive Copy for Ty, graceful argument parsing, resilient request loop
|
|
#
|
|
diff --git a/audiod/src/main.rs b/audiod/src/main.rs
|
|
index 51b103af..2354cf5f 100644
|
|
--- a/audiod/src/main.rs
|
|
+++ b/audiod/src/main.rs
|
|
@@ -48,7 +48,14 @@ fn daemon(daemon: SchemeDaemon) -> anyhow::Result<()> {
|
|
|
|
let pid = libredox::call::getpid()?;
|
|
|
|
- let hw_file = Fd::open("/scheme/audiohw", flag::O_WRONLY | flag::O_CLOEXEC, 0)?;
|
|
+ let hw_file = match Fd::open("/scheme/audiohw", flag::O_WRONLY | flag::O_CLOEXEC, 0) {
|
|
+ Ok(fd) => fd,
|
|
+ Err(err) if err.errno() == syscall::ENODEV => {
|
|
+ eprintln!("audiod: no audio hardware detected");
|
|
+ return Ok(());
|
|
+ }
|
|
+ Err(err) => return Err(err).context("failed to open /scheme/audiohw"),
|
|
+ };
|
|
|
|
let socket = Socket::create().context("failed to create scheme")?;
|
|
|