File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/python
22#
33# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
4- # Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+ # Copyright (c) 2020-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
55# SPDX-License-Identifier: GPL-2.0-only
66#
77# This program is free software; you can redistribute it and/or modify it
7979#############################
8080import sys
8181import argparse
82+ import os
8283import os .path
8384import subprocess
8485import struct
8586import binascii
8687import zlib
8788import tempfile
8889import shutil
90+ import stat
8991
9092
9193#############################
@@ -761,8 +763,12 @@ def save_fru(fru_dict, out_filename):
761763 else :
762764 tmp_file .write ("{}\n " .format (str (item [1 ]).rstrip ()))
763765
766+ # Set permissions on temporary file to allow read access for all users (rw-r--r--)
767+ # This must be done before rename to maintain atomicity
768+ os .chmod (tmp_filename , stat .S_IRUSR | stat .S_IWUSR | stat .S_IRGRP | stat .S_IROTH )
769+
764770 # Atomically rename the temporary file to the target filename
765- # On POSIX systems, this is an atomic operation
771+ # On POSIX systems, this is an atomic operation that preserves permissions
766772 os .replace (tmp_filename , out_filename )
767773
768774 except (IOError , OSError ) as err :
You can’t perform that action at this time.
0 commit comments