2
0
mirror of https://opendev.org/x/pyghmi synced 2025-08-09 12:50:16 +00:00

Fix localsession for python2

Commands without data were causing problems
for python2 ctypes interface.  Skip the
copy attempt when there is no data to
copy.

Change-Id: If115a1145c277992aa4ffbe420a582dc08d0926e
This commit is contained in:
Jarrod Johnson
2020-04-02 08:09:02 -04:00
parent 5391281a7e
commit ec3411b492

View File

@@ -122,7 +122,8 @@ class Session(object):
self.req.msg.netfn = netfn
self.req.msg.cmd = command
data = memoryview(bytearray(data))
self.databuffer[:len(data)] = data[:len(data)]
if data:
self.databuffer[:len(data)] = data[:len(data)]
self.req.msg.data_len = len(data)
fcntl.ioctl(self.ipmidev, IPMICTL_SEND_COMMAND, self.req)
self.await_reply()