Add workaround to have checkrestart work in OpenVZ environments
with patch provided by Ralf Jung (closes: #747003)
Javier Fernandez-Sanguino
9 years ago
321 | 321 | process.links.append(data) |
322 | 322 | elif field == 'n': |
323 | 323 | # Remove the previous entry to check if this is something we should use |
324 | if data.startswith('/SYSV'): | |
324 | if data.find('SYSV') >= 0: | |
325 | 325 | # If we find SYSV we discard the previous descriptor |
326 | 326 | last = process.descriptors.pop() |
327 | elif data.startswith('/'): | |
327 | elif data.startswith('/') or data.startswith('(deleted)/') or data.startswith(' (deleted)/'): | |
328 | 328 | last = process.descriptors.pop() |
329 | ||
330 | # If the data starts with (deleted) put it in the end of the | |
331 | # file name, this is used to workaround different behaviour in | |
332 | # OpenVZ systems, see | |
333 | # https://bugzilla.openvz.org/show_bug.cgi?id=2932 | |
334 | if data.startswith('(deleted)'): | |
335 | data = data[9:] + ' (deleted)' | |
336 | elif data.startswith(' (deleted)'): | |
337 | data = data[10:] + ' (deleted)' | |
338 | ||
329 | 339 | # Add it to the list of deleted files if the previous descriptor |
330 | 340 | # was DEL or lsof marks it as deleted |
331 | 341 | if re.compile("DEL").search(last) or re.compile("\(deleted\)").search(data) or re.compile("\(path inode=[0-9]+\)$").search(data): |