From 1da17f616cbaed97a41f571397ae17c3ef4ff8e0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 20 Oct 2003 21:57:59 +0000 Subject: 0.19 finished git-svn-id: file:///home/lennart/svn/public/ifplugd/trunk@58 2bf48fe7-cfc1-0310-909f-d9042e1e0fef --- Makefile.am | 2 +- bootstrap.sh | 4 +--- configure.ac | 3 ++- doc/Makefile.am | 2 +- doc/README.html.in | 10 ++++++++-- src/ifplugd.c | 36 ++++++++++++++++++++++++++++++++---- 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index a3d7173..c2524dd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,5 +37,5 @@ homepage: all dist distcleancheck: @: - + .PHONY: homepage distcleancheck diff --git a/bootstrap.sh b/bootstrap.sh index 583cdea..7697c97 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: bootstrap.sh 20 2003-07-10 16:21:55Z lennart $ +# $Id$ # This file is part of ifplugd. # @@ -24,8 +24,6 @@ if [ "x$1" = "xam" ] ; then else set -ex -# make maintainer-clean || true - rm -rf autom4te.cache rm -f config.cache diff --git a/configure.ac b/configure.ac index 82b583d..4cd28a0 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. AC_PREREQ(2.57) -AC_INIT([ifplugd], [0.18], [mzvscyhtq (at) 0pointer (dot) de]) +AC_INIT([ifplugd], [0.19], [mzvscyhtq (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/ifplugd.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign -Wall]) @@ -48,6 +48,7 @@ AC_PROG_MAKE_SET # Checks for libraries. AC_CHECK_LIB([daemon], [daemon_fork],, [AC_MSG_ERROR([*** Sorry, you have to install libdaemon ***])]) +AC_CHECK_LIB([daemon], [daemon_pid_file_kill_wait],, [AC_MSG_WARN([*** libdaemon too old, --wait-on-kill is not going to be supported. Consider updating to libdaemon 0.3. ***])]) # Checks for header files. AC_HEADER_STDC diff --git a/doc/Makefile.am b/doc/Makefile.am index 61f2444..2536a1f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am 22 2003-06-15 16:36:33Z lennart $ +# $Id$ # This file is part of ifplugd. # diff --git a/doc/README.html.in b/doc/README.html.in index 62c8cd3..f827c0b 100644 --- a/doc/README.html.in +++ b/doc/README.html.in @@ -42,6 +42,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

News

+
Mon Oct 20 2003:

Version +0.19 released, changes include: New option --wait-for-kill, this requires libdaemon 0.3

+
Fri Oct 17 2003:

Version 0.18 released, changes include: Some bugs fixed

@@ -101,8 +105,10 @@ the interface when a cable is really connected.

(-d option) or short "plugged" periods(-u option) -
  • Support for wireless networking. Whenever an AP is detected the -network is configured.
  • +
  • Support for wireless networking. Whenever an association to an +AP is detected the network is configured. Have a look on waproamd +if you need a facility to configure WEP keys before AP associations succeed.
  • Compatibility mode for network devices which do not support cable detection (-F option)
  • diff --git a/src/ifplugd.c b/src/ifplugd.c index 322870f..5ddf92e 100644 --- a/src/ifplugd.c +++ b/src/ifplugd.c @@ -77,6 +77,9 @@ int daemonize = 1, use_beep = 1, no_shutdown_script = 0, wait_on_fork = 0, +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + wait_on_kill = 0, +#endif use_syslog = 1, ignore_retval = 0, initial_down = 0, @@ -634,6 +637,9 @@ void usage(char *p) { " -q --no-shutdown Don't run script on daemon quit (%s)\n" " -l --initial-down Run \"down\" script on startup if now cable is detected (%s)\n" " -w --wait-on-fork Wait until daemon fork finished (%s)\n" +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + " -W --wait-on-kill When run with -k, wait until the daemon died (%s)\n" +#endif " -x --extra-arg Specify an extra argument for action script\n" " -M --monitor Use interface monitoring (%s)\n" " -h --help Show this help\n" @@ -660,6 +666,9 @@ void usage(char *p) { no_shutdown_script ? "on" : "off", initial_down ? "on" : "off", wait_on_fork ? "on" : "off", +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + wait_on_kill ? "on" : "off", +#endif use_ifmonitor ? "on" : "off"); } @@ -679,6 +688,9 @@ void parse_args(int argc, char *argv[]) { {"delay-down", required_argument, 0, 'd'}, {"api-mode", required_argument, 0, 'm'}, {"wait-on-fork", no_argument, 0, 'w'}, +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + {"wait-on-kill", no_argument, 0, 'W'}, +#endif {"no-shutdown", no_argument, 0, 'q'}, {"help", no_argument, 0, 'h'}, {"kill", no_argument, 0, 'k'}, @@ -698,7 +710,7 @@ void parse_args(int argc, char *argv[]) { for (;;) { int c; - if ((c = getopt_long(argc, argv, "asni:r:t:u:d:hkbfFvm:qwx:cISRzlM", long_options, &option_index)) < 0) + if ((c = getopt_long(argc, argv, "asni:r:t:u:d:hkbfFvm:qwx:cISRzlMW", long_options, &option_index)) < 0) break; switch (c) { @@ -774,7 +786,12 @@ void parse_args(int argc, char *argv[]) { case 'w': wait_on_fork = !wait_on_fork; break; - case 'x': +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + case 'W': + wait_on_kill = !wait_on_kill; + break; +#endif + case 'x': extra_arg = strdup(optarg); break; case 'S': @@ -809,7 +826,16 @@ void parse_args(int argc, char *argv[]) { } if (_kill || _resume || _suspend || _info) { - if (daemon_pid_file_kill(_kill ? SIGINT : (_resume ? SIGUSR2 : (_info ? SIGHUP : SIGUSR1))) < 0) { + int rv; + +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + if (_kill && wait_on_kill) + rv = daemon_pid_file_kill_wait(SIGINT, 5); + else +#endif + rv = daemon_pid_file_kill(_kill ? SIGINT : (_resume ? SIGUSR2 : (_info ? SIGHUP : SIGUSR1))); + + if (rv < 0) { daemon_log(LOG_ERR, "Failed to kill daemon. (%s)", strerror(errno)); exit(6); } @@ -892,7 +918,9 @@ int main(int argc, char* argv[]) { kill(pid, SIGTERM); } - + if (c) + daemon_log(LOG_ERR, "Daemon failed with error condition #%i. See syslog for details", c); + return c; } } -- cgit