| ▲ | 1718627440 4 hours ago | |||||||||||||||||||||||||
> because the handle is independent of the path. This makes me wonder, what happens [EDIT: on Windows] when a program uses a file, which more than a single hardlink points to, and you want to remove one of them. Does it matter, through which hardlink the file gets opened or are all the hardlinks prevented from being unlinked? | ||||||||||||||||||||||||||
| ▲ | Chu4eeno 3 hours ago | parent | next [-] | |||||||||||||||||||||||||
On Linux you can delete all hardlinks to open files. What you can't do is modify a file that's executing (program or library), then you get ETXTBSY. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
| ▲ | yjftsjthsd-h 3 hours ago | parent | prev [-] | |||||||||||||||||||||||||
Hard links are just pointers to the file. You can remove any or all of them independently of each other and the running program. In fact, IIRC there's a semi-common pattern where a program will deliberately create a file, open it, and then unlink it, which leaves it usable but anonymous and in a state that will always be garbage-collected when the program exits. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||