1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Use errno.ENOSYS instead of 38.

This commit is contained in:
Alexandre Beloin 2015-02-08 20:07:52 -05:00
parent de6cd8d9f1
commit b283015d38

View File

@ -5,6 +5,7 @@ import os
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked) AlreadyLocked)
import errno
class LinkLockFile(LockBase): class LinkLockFile(LockBase):
"""Lock access to a file using atomic property of link(2). """Lock access to a file using atomic property of link(2).
@ -29,7 +30,7 @@ class LinkLockFile(LockBase):
try: try:
os.link(self.unique_name, self.lock_file) os.link(self.unique_name, self.lock_file)
except OSError as e: except OSError as e:
if e.errno == 38: if e.errno == errno.ENOSYS:
raise LockFailed("%s" % e.strerror) raise LockFailed("%s" % e.strerror)
# Link creation failed. Maybe we've double-locked? # Link creation failed. Maybe we've double-locked?
nlinks = os.stat(self.unique_name).st_nlink nlinks = os.stat(self.unique_name).st_nlink