Skip to content

Commit 1abe621

Browse files
tylerfanellijakecorrenti
authored andcommitted
nitro: Return error message if no rootfs dirname
If the rootfs directory name cannot be converted to a str, return an error indicating so. Signed-off-by: Tyler Fanelli <[email protected]>
1 parent 4e3a27f commit 1abe621

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/nitro/src/enclaves.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ impl NitroEnclave {
8585
.file_name()
8686
.unwrap_or(OsStr::new("/"))
8787
.to_str()
88-
.unwrap();
88+
.ok_or(NitroError::RootFsArchive(io::Error::new(
89+
ErrorKind::Other,
90+
"unable to convert rootfs directory name to str",
91+
)))?;
8992

9093
for entry in fs::read_dir(pathbuf).map_err(NitroError::RootFsArchive)? {
9194
let entry = entry.map_err(NitroError::RootFsArchive)?;

0 commit comments

Comments
 (0)