What happens to an open file handle on Linux if the pointed file meanwhile gets:
- Moved away -> Does the file handle stay valid?
- Deleted -> Does this lead to an EBADF, indicating an invalid file handle?
- Replaced by a new file -> Does the file handle pointing to this new file?
- Replaced by a hard link to a new file -> Does my file handle "follow" this link?
- Replaced by a soft link to a new file -> Does my file handle hit this soft link file now?
Why I'm asking such questions: I'm using hot-plugged hardware (such as USB devices etc.). It can happen, that the device (and also its /dev/file) gets reattached by the user or another Gremlin.
What's the best practice dealing with this?