Skip to content
Snippets Groups Projects
  • Tomasz Grabiec's avatar
    1fe30840
    vfs: namei() should return ENOTDIR when component is not a directory · 1fe30840
    Tomasz Grabiec authored
    
    The call to namei("/dir/file/") currently fails with ENOENT when
    "/dir/file" exists. A more standard way is to return ENOTDIR
    instead. This way calls to stat, open, rename, etc. will be in
    line with the POSIX spec.
    
    It is also useful to rename() implementation which needs to
    differentiate behaviour between the case in which target does not
    exist and the case in which it does but the path has trailing slash
    and the last component is not a directory.
    
    In addition to that the check was performed in an inconsistent matter
    - only when dentry lookup failed. This change makes the check
    performed always.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
    1fe30840
    History
    vfs: namei() should return ENOTDIR when component is not a directory
    Tomasz Grabiec authored
    
    The call to namei("/dir/file/") currently fails with ENOENT when
    "/dir/file" exists. A more standard way is to return ENOTDIR
    instead. This way calls to stat, open, rename, etc. will be in
    line with the POSIX spec.
    
    It is also useful to rename() implementation which needs to
    differentiate behaviour between the case in which target does not
    exist and the case in which it does but the path has trailing slash
    and the last component is not a directory.
    
    In addition to that the check was performed in an inconsistent matter
    - only when dentry lookup failed. This change makes the check
    performed always.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>