Use env var SUDO_USER when logname cannot determine username

When compiling from openvz, if you've entered your container by doing a `vzctl enter CTID` there is no logname defined, so `logname` won't work, but $SUDO_USER can be used.

I guess that this should fix compiling from any non-login shell.