From: Karim Hamidou Date: Mon, 11 Dec 2017 02:53:05 +0000 (-0800) Subject: More fixes! X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=231e7eb37d5bfd528a18f99b75919db509ebd24e;p=minival.git More fixes! --- diff --git a/web.py b/web.py index 84150ff..0c4f2ee 100644 --- a/web.py +++ b/web.py @@ -28,8 +28,11 @@ def main(): def execute_in_sandbox(code): tmp_fd, tmp_filename = tempfile.mkstemp(suffix='.py') - tmp_fd.write('import prctl ; prctl.set_seccomp(True)') - tmp_fd.write(code) + os.close(tmp_fd) + + with open(tmp_filename, 'w+') as fd: + fd.write('import prctl ; prctl.set_seccomp(True)') + fd.write(code) read_pipe, write_pipe = os.pipe() pid = os.fork()