Messages in this thread | | | Date | Sun, 4 Dec 2011 21:00:27 +0000 | From | Al Viro <> | Subject | Re: Is there a reason hard links from /proc/$PID/fd/$NUM are disallowed? |
| |
On Sun, Dec 04, 2011 at 03:40:44PM -0500, George Spelvin wrote: > I was trying to save a large file that was in mid-download that I had > accidentally deleted (as part of making space in /tmp to hold the file!). > > Since it was being held open by the download process, I tried > > ln /proc/$PID/fd/$FD /tmp/bigfile.mp4
You do realize that link(2) does *NOT* follow links, do you? linkat(2) does, if you explicitly ask for that:
linkat(AT_FDCWD, "/proc/42/fd/1", AT_FDCWD, "/tmp/foo", AT_SYMLINK_FOLLOW)
will do it just fine.
| |