New submission from Gary Stanley <[EMAIL PROTECTED]>: FreeBSD has a bug in telldir that returns incorrect results, causing memory leaks and other odd behavior. This bug was fixed in NetBSD, and I've created a patch based on NetBSD's changes. This will also add a pointer to dd_internal in dirent.h, which will probably require a version bump because the size of that struct will change. I didn't bother bumping version here because it seems it didn't effect anything (ls, du, etc), but its better to be safe than sorry.
The code to generate the issue is here: http://leaf.dragonflybsd.org/~gary/patches/libc/seekdir-twice.c Fixed telldir: first found: a pos returned by telldir: 135286864 second found: b third found: c should be == second: b pos given to seekdir: 135286864 pos returned by telldir: 135286864 should be == second: b should be == second: b Broken telldir: first found: a pos returned by telldir: 1 second found: b third found: c should be == second: b pos given to seekdir: 1 pos returned by telldir: 2 should be == second: c should be == second: c The patch is located here: http://leaf.dragonflybsd.org/~gary/patches/libc/libc-telldir-memleaks.patch Some notes: telldir's behavior now follows opengroup's behavior, that it isn't const, which it seems is more of a standards issue than anything. http://www.opengroup.org/onlinepubs/009695399/functions/telldir.html tgen@ has looked over the patch and says its good, only concern was the unconst change to telldir, which I explained to him above :) ---------- messages: 4501 nosy: gstanley priority: bug status: unread title: telldir/seekdir broken [PATCH] _____________________________________________________ DragonFly issue tracker <[EMAIL PROTECTED]> <https://bugs.dragonflybsd.org/issue992> _____________________________________________________
