Exemplo n.º 1
0
    def __init__(self, cfg):
        old_umask = os.umask(cfg.get("umask", 0))
        fd, name = tempfile.mkstemp(prefix="wgunicorn-")

        # allows the process to write to the file
        util.chown(name, cfg.get("uid", os.geteuid()), cfg.get("gid",
            os.getegid()))
        os.umask(old_umask)

        # unlink the file so we don't leak tempory files
        try:
            os.unlink(name)
            self._tmp = os.fdopen(fd, 'w+b', 1)
        except:
            os.close(fd)
            raise

        self.spinner = 0
Exemplo n.º 2
0
 def bind(self, sock):
     old_umask = os.umask(self.conf.get("umask", 0))
     sock.bind(self.address)
     util.chown(self.address, self.conf.get("uid", os.geteuid()),
             self.conf.get("gid", os.getegid()))
     os.umask(old_umask)