Skip to content

Commit c9b574d

Browse files
Janne Grunaualyssarosenzweig
authored andcommitted
guest/net: Handle missing /etc/hostname gracefully
The error handled in #74 was muvm-guest's network code. So fixing it here directly. Not sure if any of the binaries running in the guest actually care about /etc/hostname. Signed-off-by: Janne Grunau <[email protected]>
1 parent 29e77d2 commit c9b574d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/muvm/src/guest/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn configure_network() -> Result<()> {
2424

2525
{
2626
let hostname =
27-
fs::read_to_string("/etc/hostname").context("Failed to read `/etc/hostname`")?;
27+
fs::read_to_string("/etc/hostname").unwrap_or("placeholder-hostname".to_string());
2828
let hostname = if let Some((hostname, _)) = hostname.split_once('\n') {
2929
hostname.to_owned()
3030
} else {

0 commit comments

Comments
 (0)