Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Detecting lchown and falling back to chown

by andy314 (Initiate)
on Feb 01, 2008 at 16:49 UTC ( #665603=note: print w/replies, xml ) Need Help??


in reply to Re: Detecting lchown and falling back to chown
in thread Detecting lchown and falling back to chown

The program is supposed to recreate permissions of files. It would be run over both symlinks and non-symlinks, and over non-symlinks any function will do, however for symlinks I would need lchown. So I want my script to have full functionality on systems with lchown and at least partial functionality on systems without it.

However you are right .. I do not really want to even attempt the chown if it is a symlink and I do not have lchown. I guess this would be more appropriate:
sub best_chown($$$) { chown(@_) unless -l $_[0]; }

Does this make sense?

Replies are listed 'Best First'.
Re^3: Detecting lchown and falling back to chown
by andy314 (Initiate) on Feb 01, 2008 at 16:57 UTC
    Messed up the parameter order. Should probably be (I never call it for more than 1 file at a time):
    sub best_chown($$$) { chown(@_) unless -l $_[2]; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://665603]
help
Chatterbox?
Corion is not sure if this is serious
[LanX]: I've already outlined. you might want to add a link
[LanX]: oopp ssorry ...
[LanX]: ... thought it's a root post

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-01-17 18:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (158 votes). Check out past polls.