Hello,

I'm testing addon with LD_PRELOAD hooking.

In the test, I made hooking object for fopen call.
When I test with this example, fopen hooking worked.

#include <stdio.h>

int main()
{}
    // ld_preload test
    FILE* fd = NULL;
    printf("Calling the fopen() function. \n");
    fd = fopen("test.txt", "r");
    if(!fd) {
      printf("ok\n");

    }
    printf("fopen() succeeded\n");
}

But, if I apply this within node addons, hooking didn't work.

NAN_METHOD(MyObject::New) {
  NanScope();

  if (args.IsConstructCall()) {
    // Invoked as constructor: `new MyObject(...)`
    MyObject* obj = new MyObject();
    obj->Wrap(args.This());

    // ld_preload test
    FILE* fd = NULL;
    printf("Calling the fopen() function. \n");
    fd = fopen("test.txt", "r");
    if(!fd) {
      printf("null\n");

    }
    printf("fopen() succeeded\n");
    
    NanReturnValue(args.This());
  } 
}


Node addon documents say that Node statically compiles all its dependencies 
into the executable.
http://nodejs.org/docs/latest/api/addons.html

Is that why LD_PRELOAD is not working?
Please guide me to solve this problem.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/3d0f83c5-38f0-4392-9080-3f521536ef4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to