re-tidied up warnings.
This commit is contained in:
@@ -25,8 +25,7 @@ module Netlink
|
|||||||
# Check the sockaddr on a received message. Raises an error if the AF
|
# Check the sockaddr on a received message. Raises an error if the AF
|
||||||
# is not AF_NETLINK or the PID is not 0 (this is important for security)
|
# is not AF_NETLINK or the PID is not 0 (this is important for security)
|
||||||
def self.check_sockaddr(str)
|
def self.check_sockaddr(str)
|
||||||
# af, pad, pid, groups = str.unpack(SOCKADDR_PACK)
|
af, _, pid, _ = str.unpack(SOCKADDR_PACK)
|
||||||
af, pid = str.unpack(SOCKADDR_PACK).values_at(0,2)
|
|
||||||
raise "Bad AF #{af}!" if af != Socket::AF_NETLINK
|
raise "Bad AF #{af}!" if af != Socket::AF_NETLINK
|
||||||
raise "Bad PID #{pid}!" if pid != 0
|
raise "Bad PID #{pid}!" if pid != 0
|
||||||
end
|
end
|
||||||
@@ -145,8 +144,7 @@ module Netlink
|
|||||||
# Discard all waiting messages
|
# Discard all waiting messages
|
||||||
def drain
|
def drain
|
||||||
while select([@socket], nil, nil, 0)
|
while select([@socket], nil, nil, 0)
|
||||||
# mesg, sender, rflags, controls = @socket.recvmsg
|
mesg, _, _, _ = @socket.recvmsg
|
||||||
mesg = @socket.recvmsg.first
|
|
||||||
raise EOFError unless mesg
|
raise EOFError unless mesg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -211,8 +209,7 @@ module Netlink
|
|||||||
# kernel closes the socket.
|
# kernel closes the socket.
|
||||||
def recvmsg(timeout=@timeout)
|
def recvmsg(timeout=@timeout)
|
||||||
if select([@socket], nil, nil, timeout)
|
if select([@socket], nil, nil, timeout)
|
||||||
# mesg, sender, rflags, controls = @socket.recvmsg
|
mesg, sender, _, _ = @socket.recvmsg
|
||||||
mesg, sender = @socket.recvmsg.first(2)
|
|
||||||
raise EOFError unless mesg
|
raise EOFError unless mesg
|
||||||
sender = sender.to_sockaddr if sender.respond_to? :to_sockaddr
|
sender = sender.to_sockaddr if sender.respond_to? :to_sockaddr
|
||||||
NLSocket.check_sockaddr(sender)
|
NLSocket.check_sockaddr(sender)
|
||||||
|
Reference in New Issue
Block a user