Hi guys, I've come across some problems while porting to FreeBSD a wrapper library which protects the filesystem from unauthorized accesses by overriding potentially dangerous functions and making some checks before calling the real thing. Turns out that overriding getcwd() resulted in segfaults because the library wrapped both getcwd() and __getcwd(), so that libc's getcwd() would call my wrapped __getcwd() instead of its own version, and my version would call libc's getcwd() again (which is wrong anyways), effectively building an infinite recursion loop.
This stems from the fact that __getcwd() is exported by FreeBSD's libc (as a weak alias to __sys___getcwd(), along with ___getcwd()), while the libc this library ran originally on (GNU) does not export it. So here come my questions: is there any legal use of __getcwd() (and the other two functions for that matter) outside the libc? Any reason explaining why it should be exported? I guess backwards compatibility can be one such reason, but I'd like to know what you people think about it, specially if they were initially exported on purpose. TIA, Alex _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"