I thought this was interesting ... so I expanded it just a wee bit:
As should be expected(?), it follows renames. And, quite interestingly ...$ (cd /tmp; perl -e 'symlink("foo","bar") or die $!; open F, ">bar" or + die $!; rename "foo", "blah" or die $!; print readlink("/proc/$$/fd/ +".fileno(F)),$/'; rm blah bar) /tmp/blah
Wow. That's cool. Imagine the abuse one could wreak on a poor programmer by creating a file "/tmp/foo \(deleted\)" :-) I suppose that testing for the file being deleted means actually testing the symlink via stat (e.g., -e).$ (cd /tmp; perl -e 'symlink("foo","bar") or die $!; open F, ">bar" or + die $!; unlink "foo" or die $!; print readlink("/proc/$$/fd/".fileno +(F)),$/'; rm bar) /tmp/foo (deleted)
In reply to Re^7: How to detect if file is in use?
by Tanktalus
in thread How to detect if file is in use?
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |