remoteloop: remove dir_fd argument in create_device
If dir_fd wasn't passed, create_device() openend it to `/dev` and forgot about closing it. To fix this, it would have to gain logic to only close the fd if it wasn't passed in. Side-step the problem by removing dir_fd, since nothing is using it right now. We can add it back if something needs it.
This commit is contained in:
parent
3d3ffda5d8
commit
356f62058f
1 changed files with 4 additions and 4 deletions
|
|
@ -112,12 +112,10 @@ class LoopClient:
|
|||
def __init__(self, sock):
|
||||
self.sock = sock
|
||||
|
||||
def create_device(self, fd, dir_fd=None, offset=None, sizelimit=None):
|
||||
def create_device(self, fd, offset=None, sizelimit=None):
|
||||
req = {}
|
||||
fds = array.array("i")
|
||||
|
||||
if not dir_fd:
|
||||
dir_fd = os.open("/dev", os.O_DIRECTORY)
|
||||
dir_fd = os.open("/dev", os.O_DIRECTORY)
|
||||
|
||||
fds.append(fd)
|
||||
req["fd"] = 0
|
||||
|
|
@ -130,6 +128,8 @@ class LoopClient:
|
|||
req["sizelimit"] = sizelimit
|
||||
|
||||
dump_fds(self.sock, req, fds)
|
||||
os.close(dir_fd)
|
||||
|
||||
ret = json.loads(self.sock.recv(1024))
|
||||
|
||||
return ret["devname"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue