Specifying multiple files with LD_PRELOAD

36,928

Solution 1

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

LD_PRELOAD="path1 path2"

ought to work.

Solution 2

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

Share:
36,928
MetallicPriest
Author by

MetallicPriest

Updated on July 08, 2022

Comments

  • MetallicPriest
    MetallicPriest almost 2 years

    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?