Skip to content
Snippets Groups Projects
Commit adc523ab authored by Iustin Pop's avatar Iustin Pop
Browse files

mlock: fail gracefully if libc.so.6 cannot be loaded


This allows noded to continue instead of blowing up if the libc major
number changes.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 87001920
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,11 @@ def Mlockall(_ctypes=ctypes): ...@@ -51,7 +51,11 @@ def Mlockall(_ctypes=ctypes):
if _ctypes is None: if _ctypes is None:
raise errors.NoCtypesError() raise errors.NoCtypesError()
libc = _ctypes.cdll.LoadLibrary("libc.so.6") try:
libc = _ctypes.cdll.LoadLibrary("libc.so.6")
except EnvironmentError, err:
logging.error("Failure trying to load libc: %s", err)
libc = None
if libc is None: if libc is None:
logging.error("Cannot set memory lock, ctypes cannot load libc") logging.error("Cannot set memory lock, ctypes cannot load libc")
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment