diff --git a/build-tools/clean_ndk_ani.py b/build-tools/clean_ndk_ani.py index 5457bfc29b55142b64f29654e20965e698f285fd..43e62f9e7ff4c0e5ed10352247a9f77b0d9c45b4 100755 --- a/build-tools/clean_ndk_ani.py +++ b/build-tools/clean_ndk_ani.py @@ -18,6 +18,7 @@ import re import argparse import shutil import json +import stat from typing import List # ani header file list @@ -100,7 +101,9 @@ def clean_json_systemCapability_headers(capability_header_path): # Saving the modified JSON try: - with open(capability_header_path, 'w') as f: + fd = os.open(capability_header_path, os.O_WRONLY | os.O_TRUNC | os.O_CREAT, + stat.S_IRUSR | stat.S_IWUSR) + with os.fdopen(fd, 'w') as f: json.dump(systemCapabilitys, f, indent=2) print("JSON file updated successfully") except Exception as e: