Specifying multiple files with LD_PRELOAD

MetallicPriest picture MetallicPriest · Dec 12, 2011 · Viewed 30.4k times · Source

I know how to override one library with LD_PRELOAD, for example, as follows.

LD_PRELOAD=./getpid.so ./testpid

Now my question is how to override multiple files. Say I want to override both getpid and getid, how would I specify that?

Answer

William Pursell picture William Pursell · Dec 12, 2011

According to the ld.so manpage, it is a space separated list. So:

LD_PRELOAD="path1 path2"

ought to work.