def set_uid(self):
        """Drop root privileges"""
        if self.gid:
            try:
                os.setgid(self.gid)
            except __HOLE__, (code, message):
                sys.exit("can't setgid(%d): %s, %s" %
                (self.gid, code, message))
        if self.uid:
            try:
                os.setuid(self.uid)
            except OSError, (code, message):
                sys.exit("can't setuid(%d): %s, %s" %
                (self.uid, code, message))
dataset/ETHPy150Open kiberpipa/Intranet/pipa/ltsp/src/ltsp_usage_monitor/daemon.py/Daemon.set_uid