This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  6f8fd11c36f9c4d5ca7f26243d90a3c672925b30 (commit)
      from  073f4fc44c6e5b95993afd555668d886c5654010 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=6f8fd11c36f9c4d5ca7f26243d90a3c672925b30


commit 6f8fd11c36f9c4d5ca7f26243d90a3c672925b30
Author: Mats Erik Andersson <[email protected]>
Date:   Sun Feb 5 23:20:45 2012 +0100

    tests/tftp.sh: Activate job control.

diff --git a/ChangeLog b/ChangeLog
index b6c7dea..1bd422c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-02-05  Mats Erik Andersson <[email protected]>
+
+       * tests/tftp.sh: Need job control, issue `set -m'.
+       (spawned_pid): New variable.
+       <inetd restart failure>: For better robustness, kill process
+       immediately using SPAWNED_PID.
+
 2012-02-04  Mats Erik Andersson <[email protected]>
 
        * src/logger.c (unixsock): New variable.
diff --git a/tests/tftp.sh b/tests/tftp.sh
index a627de0..38faba6 100755
--- a/tests/tftp.sh
+++ b/tests/tftp.sh
@@ -21,13 +21,16 @@
 
 # Prerequisites:
 #
-#  * Shell: SVR4 Bourne shell, or newer.
+#  * Shell: SVR4 Bourne shell, or newer, and allowing job control.
 #
 #  * cat(1), expr(1), head(1), kill(1), pwd(1), rm(1).
 #
 #  * cmp(1), dd(1), id(1), grep(1), mktemp(1), netstat(8),
 #    ps(1), sed(1), uname(1).
 
+# Need job control when spawning Inetd.
+set -m
+
 if [ "$VERBOSE" ]; then
     set -x
 fi
@@ -175,6 +178,9 @@ test -n "${VERBOSE+yes}" || REDIRECT='2>/dev/null'
 
 eval "$INETD -d -p'$INETD_PID' '$INETD_CONF' $REDIRECT &"
 
+# Debug mode allows the shell to recover PID of Inetd.
+spawned_pid=$!
+
 sleep 2
 
 inetd_pid="`cat $INETD_PID 2>/dev/null`" ||
@@ -213,6 +219,7 @@ if test $? -ne 0; then
        }
 
     $INETD -d -p"$INETD_PID" "$INETD_CONF" &
+    spawned_pid=$!
     sleep 2
     inetd_pid="`cat $INETD_PID 2>/dev/null`" ||
        {
@@ -221,6 +228,7 @@ if test $? -ne 0; then
                but loosing control whether an Inetd process is
                still around.
                EOT
+           ps "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 
2>/dev/null
            exit 1
        }
 
@@ -230,6 +238,7 @@ if test $? -ne 0; then
        : # Successful this time.
     else
        echo "Failed again at starting correct Inetd instance." >&2
+       ps "$spawned_pid" >/dev/null 2>&1 && kill -9 "$spawned_pid" 2>/dev/null
        exit 1
     fi
 fi

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog     |    7 +++++++
 tests/tftp.sh |   11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 

_______________________________________________
Commit-inetutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/commit-inetutils

Reply via email to