summaryrefslogtreecommitdiff
path: root/libc/kernel/tools/clean_header.py
diff options
context:
space:
mode:
authorDaniel Mentz <danielmentz@google.com>2019-04-04 11:51:29 -0700
committerDaniel Mentz <danielmentz@google.com>2019-04-15 15:03:39 -0700
commit6d6b4cedd16c3b4d6de114c622739fc5d52f4c57 (patch)
treef5c3374ff8cc504b3ef829a70c9df822dbf79a3e /libc/kernel/tools/clean_header.py
parent9586c0f4f421e63342074eeae9806cf11d622703 (diff)
clean_header: Fix error handling for no-such-file case
The function cleanupFile should always return a single value (as opposed to a tuple or list). In addition, if it encounters an error, it is expected to return a value that evaluates to False. As it stands, however, it returns (None, None) in certain error cases. Change this function to return None, in those cases. We previously saw the following error message, when we tried to run clean_header.py on a non-existent file. Traceback (most recent call last): File "clean_header.py", line 208, in <module> b.updateGitFiles() File "utils.py", line 164, in updateGitFiles self._writeFile(dst) File "utils.py", line 136, in _writeFile f.write(self.new_data[dst]) TypeError: expected a string or other character buffer object Change-Id: I5f717dd1a4388f598f0fd4bfd5e6129017de9095
Diffstat (limited to 'libc/kernel/tools/clean_header.py')
-rwxr-xr-xlibc/kernel/tools/clean_header.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py
index b79c9b690..88b2ae008 100755
--- a/libc/kernel/tools/clean_header.py
+++ b/libc/kernel/tools/clean_header.py
@@ -86,11 +86,11 @@ def cleanupFile(dst_file, src_file, rel_path, no_update = True):
# Check the header path
if not os.path.exists(src_file):
print_error(no_update, "'%s' does not exist\n" % src_file)
- return None, None
+ return None
if not os.path.isfile(src_file):
print_error(no_update, "'%s' is not a file\n" % src_file)
- return None, None
+ return None
# Extract the architecture if found.
arch = None