Skip to content

Commit 3f723cf

Browse files
author
Yorhel
committed
Add Entry::FileType::Unknown to represent value 0
archive_entry_filetype() can return 0. It does this for hard links in a GNU tar-created archive.
1 parent d4d2b34 commit 3f723cf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/archive.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pub enum FileType {
101101
NamedPipe,
102102
Mount,
103103
RegularFile,
104+
Unknown,
104105
}
105106

106107
pub trait Handle {
@@ -134,6 +135,7 @@ pub trait Entry {
134135
ffi::AE_IFMT => FileType::Mount,
135136
ffi::AE_IFREG => FileType::RegularFile,
136137
ffi::AE_IFSOCK => FileType::Socket,
138+
0 => FileType::Unknown,
137139
code => unreachable!("undefined filetype: {}", code),
138140
}
139141
}
@@ -184,6 +186,7 @@ pub trait Entry {
184186
FileType::Mount => ffi::AE_IFMT,
185187
FileType::RegularFile => ffi::AE_IFREG,
186188
FileType::Socket => ffi::AE_IFSOCK,
189+
FileType::Unknown => 0,
187190
};
188191
ffi::archive_entry_set_filetype(self.entry(), file_type);
189192
}

0 commit comments

Comments
 (0)