envoyd: refactor getuid() checks