4 ms·
The idea is you need to allocate and resize larger if your initial buffer was too small. It doesn't matter what inconsistent length you start with as long as y
by loeg 10y ago
The idea is you need to allocate and resize larger if your initial buffer was too small. It doesn't matter what inconsistent length you start with as long as you scale it up as needed.
- the_mitsuhiko 10y agoThat's a DOS in the kernel waiting to happen.
- loeg 10y agoUserspace is responsible for constructing paths. Also, Hurd has some interesting views on what belongs in the kernel (and anything to do with paths probably doesn't). (I don't use or hack on Hurd, it's just an interesting example for PATH_MAX.)
- the_mitsuhiko 10y agoI will still need to pass thebpath to the kernel. If I ipen a 3GB filename'd file the kernel will have an issue.
- loeg 10y agoWhy do you think it would be a problem?
- ygra 10y agoI actually like that some Windows APIs you pass a buffer to will tell you if the buffer was too small and the necessary size to accommodate the result, requiring a bit less guessing.
- dom0 10y agoIt's still a race though - you have to loop (possibly indefinitely).
- wfunction 10y agoIt's funny because I know this but I'm pretty sure I forget it when coding...
- ygra 10y agoOk, didn't think of another thread changing the directory. Still, there's an upper bound around 32 kilo code units, so not indefinitely. Unless UNC paths are not bounded, don't know about that right now.
- dom0 10y agoTrue, thought the wrong way about it.