Skip to content

Commit 1dbf790

Browse files
committed
Don't delete local policy on failures
Fixes: QubesOS/qubes-issues#10745
1 parent b0284bb commit 1dbf790

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

qrexec/tools/qubes_policy_editor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525

2626
from __future__ import print_function
2727
import argparse
28+
import os
2829
import subprocess
2930
import sys
3031
import tempfile
32+
3133
from ..policy.admin_client import PolicyClient
3234
from ..policy.admin import PolicyAdminException
3335
from .. import RPCNAME_ALLOWED_CHARSET
@@ -87,7 +89,7 @@ def manage_policy(self) -> None:
8789
sys.exit(1)
8890

8991
# pylint: disable=consider-using-with
90-
tmpfile = tempfile.NamedTemporaryFile(suffix=suffix)
92+
tmpfile = tempfile.NamedTemporaryFile(suffix=suffix, delete=False)
9193

9294
if file_exists:
9395
with open(tmpfile.name, "w", encoding="utf-8") as current_file:
@@ -119,6 +121,7 @@ def manage_policy(self) -> None:
119121
sys.exit(1)
120122

121123
tmpfile.close()
124+
os.remove(self.tmpfile_name)
122125

123126
def get_reply(self) -> None:
124127
"""

0 commit comments

Comments
 (0)