Skip to content

Commit

Permalink
ignore Read-only file system error on sysctl set
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hunt <[email protected]>
  • Loading branch information
haircommander committed Jan 29, 2024
1 parent eb4251b commit a6eeb11
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/network/core_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,18 @@ impl CoreUtils {
}
Err(e) => return Err(e),
}
ctl.set_value_string(val)
let result = ctl.set_value_string(val);
// if we have a read only /proc we ignore it as well
match result {
Ok(_) => result,
Err(SysctlError::IoError(e)) => {
if e.raw_os_error() == Some(libc::EROFS) {
return Ok(String::from(""));
}
return Err(e.into());
},
Err(err) => return Err(err),
}
}
}

Expand Down Expand Up @@ -433,9 +444,6 @@ pub fn disable_ipv6_autoconf(if_name: &str) -> NetavarkResult<()> {
// just ignore that case
}

// if we have a read only /proc we ignore it as well
SysctlError::IoError(ref e) if e.raw_os_error() == Some(libc::EROFS) => {}

_ => {
return Err(NetavarkError::wrap(
"failed to set autoconf sysctl",
Expand Down

0 comments on commit a6eeb11

Please sign in to comment.