From a79a044a259940ac0c19fca5a5831ba362836f2a Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Tue, 28 May 2024 19:59:36 +0200 Subject: [PATCH] Remove unnecessary os module import and file xattr removal code The import of the 'os' module is eliminated to clean up the code, as it is no longer needed. Furthermore, the code for removing the extended attribute from all files in the current directory has been removed as well. This streamlines the setxattr function and focuses only on setting the attributes without additional file operations. --- system/loggerd/xattr_cache.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/system/loggerd/xattr_cache.py b/system/loggerd/xattr_cache.py index 8d950f71a2..88aa4f7916 100644 --- a/system/loggerd/xattr_cache.py +++ b/system/loggerd/xattr_cache.py @@ -1,4 +1,3 @@ -import os import errno import platform @@ -27,25 +26,4 @@ def getxattr(path: str, attr_name: str) -> bytes | None: def setxattr(path: str, attr_name: str, attr_value: bytes) -> None: _cached_attributes.pop((path, attr_name), None) - return _setxattr(path, attr_name, attr_value) - - - - -import os - -# Get the list of all files in current directory -files = os.listdir('.') - -# Iterate over the list of files -for file_name in files: - # Construct full file path - file_path = os.path.join('.', file_name) - # Check if it's a regular file - if os.path.isfile(file_path): - # Try to remove the xattr, if it exists - try: - os.removexattr(file_path, "user.sunny.upload") - print(f"Removed xattr from {file_name}") - except OSError: - print(f"No such xattr on {file_name}") \ No newline at end of file + return _setxattr(path, attr_name, attr_value) \ No newline at end of file