Skip to content
  • Linus Torvalds's avatar
    Fix possible Solaris problem in 'checkout_entry()' · 971f229c
    Linus Torvalds authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Currently when checking out an entry "path", we try to unlink(2) it first
    (because there could be stale file), and if there is a directory there,
    try to deal with it (typically we run recursive rmdir).  We ignore the
    error return from this unlink because there may not even be any file
    there.
    
    However if you are root on Solaris, you can unlink(2) a directory
    successfully and corrupt your filesystem.
    
    This moves the code around and check the directory first, and then
    unlink(2).  Also we check the error code from it.
    
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    971f229c