I am trying to use LD_PRELOAD
to intercept calls to syslog()
. I could successfully try that on one of my program and it worked.
When I tried it on a pre-built application (came via a Debian package), I observed that it invokes __syslog_chk()
, on inspecting the source of the package, there were no direct calls to __syslog_chk()
!
So, it ought to be the compiler [whichever was used], changed the syslog()
s to __syslog_chk()
?
I tried with gcc
options -D_FORTIFY_SOURCE=2
, -O2
etc. None of them seemed to make this change! Which option forces use of __chk()
function ?