From e0aae9c67c7115c6d7d02721a2b84d6e3aaa0045 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 21 Jan 2014 09:51:37 +0000 Subject: [PATCH] re-tidied up warnings. --- lib/linux/netlink/nlsocket.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/linux/netlink/nlsocket.rb b/lib/linux/netlink/nlsocket.rb index 6533992..5f6ba45 100644 --- a/lib/linux/netlink/nlsocket.rb +++ b/lib/linux/netlink/nlsocket.rb @@ -25,8 +25,7 @@ module Netlink # 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) def self.check_sockaddr(str) - # af, pad, pid, groups = str.unpack(SOCKADDR_PACK) - af, pid = str.unpack(SOCKADDR_PACK).values_at(0,2) + af, _, pid, _ = str.unpack(SOCKADDR_PACK) raise "Bad AF #{af}!" if af != Socket::AF_NETLINK raise "Bad PID #{pid}!" if pid != 0 end @@ -145,8 +144,7 @@ module Netlink # Discard all waiting messages def drain while select([@socket], nil, nil, 0) - # mesg, sender, rflags, controls = @socket.recvmsg - mesg = @socket.recvmsg.first + mesg, _, _, _ = @socket.recvmsg raise EOFError unless mesg end end @@ -211,8 +209,7 @@ module Netlink # kernel closes the socket. def recvmsg(timeout=@timeout) if select([@socket], nil, nil, timeout) - # mesg, sender, rflags, controls = @socket.recvmsg - mesg, sender = @socket.recvmsg.first(2) + mesg, sender, _, _ = @socket.recvmsg raise EOFError unless mesg sender = sender.to_sockaddr if sender.respond_to? :to_sockaddr NLSocket.check_sockaddr(sender)