diff options
author | Craig A. Berry <craigberry@mac.com> | 2013-12-01 17:16:47 -0600 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2013-12-02 22:45:36 -0600 |
commit | f0d85c30acfcf77bee20b9f00a787e5b796dff9c (patch) | |
tree | a1a38c601d1b5119a6849b8666539b16add2a7dd /t/io/fs.t | |
parent | 1dcae8b8dd1e2aa373ab045fee3d4f95d34f0b3c (diff) | |
download | perl-f0d85c30acfcf77bee20b9f00a787e5b796dff9c.tar.gz |
Check unlink on directory for all users, not just root.
For cross-platform consistency, it makes more sense to reject
unlink attempts on directories in the same way for all users
rather than only for root. geteuid() always returns zero on
Windows, never returns zero on VMS, and is a poor indicator
of privilege on modern unixen, so the code really hasn't been
working as intended on all platforms anyway.
Diffstat (limited to 't/io/fs.t')
-rw-r--r-- | t/io/fs.t | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -457,11 +457,9 @@ ok(-d $tmpdir1, "rename on directories working"); ok(1, "extend sp in pp_chown"); } -# Calling unlink on a directory as root without -U will always fail, but +# Calling unlink on a directory without -U and privileges will always fail, but # it should set errno to EISDIR even though unlink(2) is never called. -SKIP: { - skip "only test unlink(dir) when running as root", 3 if $> != 0; - +{ require Errno; my $tmpdir = tempfile(); @@ -477,15 +475,15 @@ SKIP: { # errno should be set even though unlink(2) is not called local $!; - is(unlink($tmpdir), 0, "can't unlink directory as root without -U"); - is(0+$!, Errno::EISDIR(), "unlink directory as root without -U sets errno"); + is(unlink($tmpdir), 0, "can't unlink directory without -U and privileges"); + is(0+$!, Errno::EISDIR(), "unlink directory without -U sets errno"); rmdir $tmpdir; # errno should be set by failed lstat(2) call $! = 0; unlink($tmpdir); - is(0+$!, Errno::ENOENT(), "unlink non-existent directory as root without -U sets ENOENT"); + is(0+$!, Errno::ENOENT(), "unlink non-existent directory without -U sets ENOENT"); } # need to remove $tmpdir if rename() in test 28 failed! |