From 75cff2d81e3f3e642c75a1f49e3d0dda6f54c087 Mon Sep 17 00:00:00 2001
From: Anael Beutot <anael.beutot@smartjog.com>
Date: Fri, 20 Jul 2012 11:53:14 +0200
Subject: [PATCH] Fix EBADF when closing fds in parent for ForkedJob

---
 cloudcontrol/node/jobs.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cloudcontrol/node/jobs.py b/cloudcontrol/node/jobs.py
index dc4dba3..8796695 100644
--- a/cloudcontrol/node/jobs.py
+++ b/cloudcontrol/node/jobs.py
@@ -285,6 +285,10 @@ class ForkedJob(object):
                 try:
                     os.close(fd)
                 except OSError as exc:
+                    if exc.errno == errno.EBADF:
+                        # FIXME this is weird but it seems to happen sometimes
+                        logger.debug('Error while closing fd in parent, EBADF')
+                        continue
                     logger.error('Error while closing fds in parent: %s',
                                  os.strerror(exc.errno))
                     raise
-- 
GitLab