in reply to Testing the current directory with Cwd and File::Spec
For example:
#get group $groups = `/usr/bin/id -G $username`; chomp $groups; # drop privileges to owner of filesystem $) = "$groups"; #setegid $> = $uid; #seteuid $currentdir = Cwd::getcwd(); my $lasterr = $!; if (not defined $currentdir) { print "getcwd() failed : @_\n"; } else { print "getcwd() for $over is OK."; }
A command like tar will usually give an error like "tar: The getwd subroutine failed. Cannot open parent directory."
This is useful to know in cases where the underlying stub directory's permissions affect programs relying on getcwd() e.g. /bin/pwd, tar etc.
0xbeef
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Testing the current directory with Cwd and File::Spec
by Celada (Monk) on Dec 07, 2005 at 00:57 UTC |