[debian-edu-commits] debian-edu/ 04/07: wakeupclients: Don't send alive pings to an empty address list. Prevents the script from hanging indefinitely when calling the fping command.

Mike Gabriel sunweaver at debian.org
Tue Feb 23 20:51:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to branch master
in repository shutdown-at-night.

commit e42a856ad67c7e190f8ae7840d4f1ef40937b747
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Feb 23 21:43:54 2016 +0100

    wakeupclients: Don't send alive pings to an empty address list. Prevents the script from hanging indefinitely when calling the fping command.
---
 debian/changelog | 2 ++
 wakeupclients    | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 7eae55d..95583a5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,8 @@ shutdown-at-night (0.17) UNRELEASED; urgency=medium
     other clients being woken up.
   * shutdown-at-night: Suppress wakeonlan output to stderr.
   * README: Document the blockage files for system wake-ups.
+  * wakeupclients: Don't send alive pings to an empty address list. Prevents
+    the script from hanging indefinitely when calling the fping command.
 
  -- Wolfgang Schweer <wschweer at arcor.de>  Sat, 17 Oct 2015 19:25:29 +0200
 
diff --git a/wakeupclients b/wakeupclients
index 6b463bc..2a95279 100755
--- a/wakeupclients
+++ b/wakeupclients
@@ -85,7 +85,11 @@ sub wakeup {
 
 sub get_alive_list {
     my @addresses = @_;
-    return split(/\s+/, `fping -a @addresses 2>/dev/null`);
+    if ($#addresses > 0) {
+        return split(/\s+/, `fping -a @addresses 2>/dev/null`);
+    } else {
+        return [];
+    }
 }
 
 sub logmsg {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/shutdown-at-night.git



More information about the debian-edu-commits mailing list