author | Linus Torvalds <torvalds@linux-foundation.org> | |
Mon, 17 Mar 2008 15:56:27 +0000 (08:56 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 19 Mar 2008 05:18:57 +0000 (22:18 -0700) | ||
commit | 971f229c50aeace83d6fd30de1de755f419d4cb8 | |
tree | 57f6caf0e971589afea7e25afa58ab4de4bbdbf4 | tree | snapshot |
parent | c4758d3c9342ea2245ca51f30f1cbf27ecc16ced | commit | diff |
Fix possible Solaris problem in 'checkout_entry()'
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: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
entry.c | diff | blob | history |