Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    86b5374f
    Fix wrong error codes in unlink(), rmdir() and readdir() · 86b5374f
    Nadav Har'El authored
    
    This patch fixes the error codes in four error cases:
    
    1. unlink() of a directory used to return EPERM (as in Posix), and now
       returns EISDIR (as in Linux).
    
    2. rmdir() of a non-empty directory used to return EEXIST (as in Posix)
       and now returns ENOTEMPTY (as in Linux).
    
    3. rmdir() of a regular file (non-directory) used to return EBADF
       and now returns ENOTDIR (as in Linux).
    
    4. readdir() of a regular file (non-directory) used to return EBADF
       and now returns ENOTDIR (as in Linux).
    
    This patch also adds a test, tst-remove.cc, for the various unlink() and
    rmdir() success and failure modes.
    
    Fixes #123.
    
    Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    86b5374f
    History
    Fix wrong error codes in unlink(), rmdir() and readdir()
    Nadav Har'El authored
    
    This patch fixes the error codes in four error cases:
    
    1. unlink() of a directory used to return EPERM (as in Posix), and now
       returns EISDIR (as in Linux).
    
    2. rmdir() of a non-empty directory used to return EEXIST (as in Posix)
       and now returns ENOTEMPTY (as in Linux).
    
    3. rmdir() of a regular file (non-directory) used to return EBADF
       and now returns ENOTDIR (as in Linux).
    
    4. readdir() of a regular file (non-directory) used to return EBADF
       and now returns ENOTDIR (as in Linux).
    
    This patch also adds a test, tst-remove.cc, for the various unlink() and
    rmdir() success and failure modes.
    
    Fixes #123.
    
    Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>