Skip to content

Commit ec6f60d

Browse files
committed
guest: Do not crash if no GPU or sound devices
This can happen if libkrun was built without those flags. Signed-off-by: Asahi Lina <[email protected]>
1 parent 7720e0f commit ec6f60d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/muvm/src/guest/user.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ pub fn setup_user(username: String, uid: Uid, gid: Gid) -> Result<PathBuf> {
3838

3939
fn setup_directories(uid: Uid, gid: Gid) -> Result<()> {
4040
for dir in ["/dev/dri", "/dev/snd"] {
41+
if !Path::new(dir).exists() {
42+
continue;
43+
}
44+
4145
let dir_iter =
4246
fs::read_dir(dir).with_context(|| format!("Failed to read directory `{dir}`"))?;
4347

0 commit comments

Comments
 (0)