diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2017-09-24 14:06:36 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2017-09-24 14:11:56 +0200 |
| commit | 3b5633913d18e06c5c36c103b9f160cce114ad9e (patch) | |
| tree | 02abe8664489c14e53b226c157303224e71f9d51 /kconfiglib.py | |
| parent | b9509c0fbc13679393389611a5c4b88b0324306a (diff) | |
Use os.access() in get_defconfig_filename()
...instead of os.path.exists(). This more closely mimics the test in the
C implementation, which boils down to fopen(file, "r") == NULL.
Could open(filename) and catch exceptions too, but it might be
overkilling things.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index d87f9cc..f726c60 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -309,13 +309,13 @@ class Config(object): for filename, cond_expr in self.defconfig_sym.def_exprs: if self._eval_expr(cond_expr) != "n": filename = self._expand_sym_refs(filename) - if os.path.exists(filename): + if os.access(filename, os.R_OK): return filename # defconfig not found. If the path is a relative path and # $srctree is set, we also look in $srctree. if not os.path.isabs(filename) and self.srctree is not None: filename = os.path.join(self.srctree, filename) - if os.path.exists(filename): + if os.access(filename, os.R_OK): return filename return None |
