Modified environment logic. Fixes bug 7695

Modified the environment manipulation logic to match the flag variable comment.
int flag = 0; // 0: default; 1: home is null before setting, should rollback

This now sets flag based upon return value of getenv()
It then sets HOME to /srv/fossology
Finally it either restores HOME to previous value or removes it based upon value of flag.

Tested successfully with cp2foss from command line for both local and remote git repositories.