Fix stat for symbolic file

This commit is contained in:
Hui, Chunyang 2020-06-09 07:14:42 +00:00 committed by Tate, Hongliang Tian
parent c8e3e0ffc6
commit bddb87a11b

@ -135,8 +135,14 @@ impl From<Metadata> for Stat {
} }
fn do_stat(path: &str) -> Result<Stat> { fn do_stat(path: &str) -> Result<Stat> {
warn!("stat is partial implemented as lstat"); debug!("stat: path: {}", path);
do_lstat(path) let inode = {
let current = current!();
let fs = current.fs().lock().unwrap();
fs.lookup_inode_follow(&path)?
};
let stat = Stat::from(inode.metadata()?);
Ok(stat)
} }
pub fn do_fstat(fd: u32) -> Result<Stat> { pub fn do_fstat(fd: u32) -> Result<Stat> {