I write a linux application for exchanging voice messages over Tor (via TCP). I would start my program like this:
torsocks my_program --connect abcdabcdabcdabcd5.onion
Is there some way my program (written in C) can check that environment is torifyed? I wish my program print warning message when it try to resolve .onion domain without torsocks.
I have tried this code:
if (!getenv("LD_PRELOAD")) printf("LD_PRELOAD is %s\n", getenv("LD_PRELOAD")); else printf("LD_PRELOAD is not set\n");
On the torifyed shell it returns "LD_PRELOAD is not set", and in normal shell it returns "LD_PRELOAD is (null)"
(Sorry my bad english)