MetallicPriest
MetallicPriest

Reputation: 30755

Specifying multiple files with LD_PRELOAD

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?

Upvotes: 71

Views: 54868

Answers (2)

William Pursell
William Pursell

Reputation: 212208

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

LD_PRELOAD="path1 path2"

ought to work.

Upvotes: 96

codaddict
codaddict

Reputation: 454960

One option is to have the overridden version of both getpid and getid in a single .so which you give to LD_PRELOAD.

Upvotes: 5

Related Questions