#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    6
    Rep Power
    0

    How to unset LD_PRELOAD in runtime for a particular process


    Hi,

    I am trying to write wrapper function for some libc functions. I am doing it by creating a library and setting it in LD_PRELOAD. For some applications I dont want to set LD_PRELOAD how to do this?

    Could anyone please help me on this?

    Thanks
    Josy
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    San Francisco Bay
    Posts
    1,939
    Rep Power
    1313
    With
    Code:
    env -u LD_PRELOAD {application}
    you should be able to run an application with the environment variable LD_PRELOAD unset.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by Lux Perpetua
    With
    Code:
    env -u LD_PRELOAD {application}
    you should be able to run an application with the environment variable LD_PRELOAD unset.
    can it be set after the application constructor is called. Only the application constructor will come to know whether the application has to be excluded from the preload.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    San Francisco Bay
    Posts
    1,939
    Rep Power
    1313
    Originally Posted by josymadamana
    can it be set after the application constructor is called. Only the application constructor will come to know whether the application has to be excluded from the preload.
    I'm not familiar with the "application constructor." If this is about Windows programming, then I can't help you, and my previous post may not apply, either.
  8. #5
  9. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,407
    Rep Power
    1871
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by Lux Perpetua
    I'm not familiar with the "application constructor." If this is about Windows programming, then I can't help you, and my previous post may not apply, either.
    thankyou.. mine is a linux programing only... all application code will be called with a constructor.. which can be modified i am searching for modifying LD_PRELOAD at runtime when constructor is called.

IMN logo majestic logo threadwatch logo seochat tools logo