Try not to rely on $USER

Summary: There are rare cases when it might not be set -- at least one
person complained in IRC of a crash due to this. Instead, try the
$LOGNAME env var, which apparently POSIX specifies should be set, and if
that doesn't work, run the `logname` command. cf:
http://unix.stackexchange.com/questions/76354/who-sets-user-and-username-environment-variables

Reviewed By: @int3

Differential Revision: D1731369

Signature: t1:1731369:1418322898:1688cb39c77b574dbf4ec3119bdead8be013fadd