3 ms·
I think you misunderstood the article. That section is not talking about actual pointers. Filenames are like pointers, opening a file is like dereferencing the
by ynik 4y ago
I think you misunderstood the article. That section is not talking about actual pointers. Filenames are like pointers, opening a file is like dereferencing the filename to get the actual file. Any other process could "free your pointer" (by deleting the file) at any point in time.
That's true no matter which language you use.
- charcircuit 4y ago>Any other process could "free your pointer" (by deleting the file) at any point in time. Files are garbage collected. There is no use after free if someone deletes your file because the OS sees that you are still using it
- hot_gril 4y agoYeah, common confusion to be out of free space, rm some huge file, and still be out of space because something has the file open.
- deleted 4y ago[deleted]
- mappu 4y agoThere's a TOCTTOU going from the filename to the file handle, but once you have a handle, - on Windows, another process deleting the file is prevented (unless you explicitly opted-in to cooperative FILE_SHARE_DELETE); and - on Linux, another process deleting the file only unlinks its name, and your handle continues working with the nameless file and its content