utils.py: lockfile(): Catch ENAMETOOLONG

Message ID 1636826280-19035-1-git-send-email-mark.hatle@kernel.crashing.org
State New
Headers show
Series utils.py: lockfile(): Catch ENAMETOOLONG | expand

Commit Message

Mark Hatle Nov. 13, 2021, 5:58 p.m. UTC
From: Mark Hatle <mark.hatle@xilinx.com>

When the filename was too long, the system would loop forever causing a
hang.  Instead we need to just drop out, as we can't correct a filename
that is too long.

Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
 lib/bb/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 7063491..0343b08 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -487,7 +487,7 @@  def lockfile(name, shared=False, retry=True, block=False):
                     return lf
             lf.close()
         except OSError as e:
-            if e.errno == errno.EACCES:
+            if e.errno == errno.EACCES or e.errno == errno.ENAMETOOLONG:
                 logger.error("Unable to acquire lock '%s', %s",
                              e.strerror, name)
                 sys.exit(1)