Skip to content

Commit d8f2855

Browse files
Tim-Zhangmxpv
authored andcommitted
shim/loop-dev: fix variable undefined error for musl
Fixes: #413 Signed-off-by: Tim Zhang <[email protected]>
1 parent 884ba3d commit d8f2855

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

crates/shim/src/mount_linux.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,21 @@ pub fn setup_loop_dev(backing_file: &str, loop_dev: &str, params: &LoopParams) -
813813
info,
814814
);
815815
#[cfg(target_env = "musl")]
816+
let ret = libc::ioctl(
817+
loop_dev.as_raw_fd() as libc::c_int,
818+
LOOP_SET_STATUS64 as libc::c_int,
819+
info,
820+
);
821+
#[cfg(target_env = "gnu")]
822+
if let Err(e) = nix::errno::Errno::result(ret) {
823+
libc::ioctl(
824+
loop_dev.as_raw_fd() as libc::c_int,
825+
LOOP_CLR_FD as libc::c_ulong,
826+
0,
827+
);
828+
return Err(Error::Nix(e));
829+
}
830+
#[cfg(target_env = "musl")]
816831
if let Err(e) = nix::errno::Errno::result(ret) {
817832
libc::ioctl(
818833
loop_dev.as_raw_fd() as libc::c_int,

0 commit comments

Comments
 (0)