ENH: more robust checking for a username/uid

This should resolve (didnt' check though ;-)) crash if neither USER nor USERNAME is defined.  I just followed the docstring promise to return '-1' when undefined