4 ms·
Isn't that why openat() exists? Of course, that isn't used nearly as much because it's annoying to have to do things that way, but it seems like the sort of thi
by mook 8y ago
Isn't that why openat() exists? Of course, that isn't used nearly as much because it's annoying to have to do things that way, but it seems like the sort of thing if you need it.
The "open things by paths" thing, IIRC, is part of the reason Windows doesn't like to let you delete open files by default.
- mehrdadn 8y agoYeah, and Windows has NtOpenFile(OBJECT_ATTRIBUTES*) to let you specify a parent directory, but these are only at the syscall level, not at the standard application API level (Win32 or C APIs don't allow it). The entire model exposed to normal applications has this problem.
- lostmsu 8y agoI though Windows won't let you move or rename a directory, if it has open files.
- mehrdadn 8y agoAlmost, but not quite. I just tried it to confirm: Windows lets you delete parent directories if they're reparse points. (I don't believe the deletion prevention was attempting to solve this problem in the first place, so this isn't really a bug or anything.)