>On 4/10/07, Frank Hofmann <[EMAIL PROTECTED]> wrote:
>> But then,
>> what's the advantage of non-portable hacks like the above versus:
>>
>> void write_stderr ( char * buf, int n )
>> {
>>         (void)write(fileno(stderr), buf, n);
>> }
>>
>> Why can you not have the library call ?
>
>The usual reason is to avoid an LD_PRELOAD. I've had to pull such
>tricks in the past when writing my own preloads.

No need, really, something like this:

 libc_execve = (int (*) (const char *, char *const [], char *const []))
                        dlsym(RTLD_NEXT,"execve");

works using the very useful RTLD_NEXT pseudo shared object.

Casper
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to