diff options
| -rwxr-xr-x | scripts/runqemu | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index b6bc0ba734..380568560b 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
| @@ -168,14 +168,14 @@ class BaseConfig(object): | |||
| 168 | 168 | ||
| 169 | def acquire_lock(self): | 169 | def acquire_lock(self): |
| 170 | logger.info("Acquiring lockfile %s..." % self.lock) | 170 | logger.info("Acquiring lockfile %s..." % self.lock) |
| 171 | lock_descriptor = open(self.lock, 'w') | ||
| 172 | try: | 171 | try: |
| 173 | fcntl.flock(lock_descriptor, fcntl.LOCK_EX|fcntl.LOCK_NB) | 172 | self.lock_descriptor = open(self.lock, 'w') |
| 173 | fcntl.flock(self.lock_descriptor, fcntl.LOCK_EX|fcntl.LOCK_NB) | ||
| 174 | except Exception as e: | 174 | except Exception as e: |
| 175 | logger.info("Acquiring lockfile %s failed: %s" % (self.lock, e)) | 175 | logger.info("Acquiring lockfile %s failed: %s" % (self.lock, e)) |
| 176 | lock_descriptor.close() | 176 | if self.lock_descriptor: |
| 177 | self.lock_descriptor.close() | ||
| 177 | return False | 178 | return False |
| 178 | self.lock_descriptor = lock_descriptor | ||
| 179 | return True | 179 | return True |
| 180 | 180 | ||
| 181 | def release_lock(self): | 181 | def release_lock(self): |
