We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7d6e68c commit e2f3501Copy full SHA for e2f3501
lib/Libki/Clients.pm
@@ -11,7 +11,6 @@ Send a magic packet for every MAC address in the ClientMACAddresses setting.
11
12
sub wakeonlan {
13
my ($c) = @_;
14
-
15
my $success = 1;
16
17
my $host = $c->setting('WOLHost') || '255.255.255.255';
@@ -23,7 +22,13 @@ sub wakeonlan {
23
22
my $socket = new IO::Socket::INET( Proto => 'udp' )
24
or $c->log()->fatal("ERROR in Socket Creation : $!\n");
25
26
- if ($socket) {
+ my $socket = new IO::Socket::INET( Proto => 'udp' )
+ or do {
27
+ $c->log()->error("Socket Creation failed: $!\n");
28
+ $success = 0;
29
+ };
30
+
31
+ if ( $success && $socket ) {
32
setsockopt( $socket, SOL_SOCKET, SO_BROADCAST, 1 );
33
34
foreach my $mac_address (@mac_addresses) {
0 commit comments