From e81a5eb522519326f266ef82a2e02fce67a4ee4f Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 14 Sep 2014 12:57:18 -0500 Subject: [PATCH] wmppp.app: Stampfile handling. This patch adds support for "stampfile" in config file, as described in manual page. Based on the patch by Juan Cespedes . See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=97509. --- wmppp.app/wmppp/wmppp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wmppp.app/wmppp/wmppp.c b/wmppp.app/wmppp/wmppp.c index 7287aa8..93adefa 100644 --- a/wmppp.app/wmppp/wmppp.c +++ b/wmppp.app/wmppp/wmppp.c @@ -192,7 +192,7 @@ #define SPEED_ACTION (NULL) #define IFDOWN_ACTION (NULL) -#define STAMP_FILE "/var/run/ppp0.pid" +#define STAMP_FILE_PRE "/var/run/wmppp." /* Defines voor alle coordinate */ @@ -362,6 +362,7 @@ char *start_action = NULL; char *stop_action = NULL; char *speed_action = NULL; char *ifdown_action = NULL; +char *stamp_file = NULL; void wmppp_routine(int argc, char **argv) { @@ -370,6 +371,7 @@ void wmppp_routine(int argc, char **argv) { { "stop", &stop_action }, { "speed", &speed_action }, { "ifdown", &ifdown_action }, + { "stampfile", &stamp_file }, { NULL, NULL } }; @@ -411,6 +413,11 @@ void wmppp_routine(int argc, char **argv) { if (STOP_ACTION) stop_action = strdup(STOP_ACTION); if (SPEED_ACTION) speed_action = strdup(SPEED_ACTION); if (IFDOWN_ACTION) ifdown_action = strdup(IFDOWN_ACTION); + if (STAMP_FILE_PRE) { + sprintf (temp, "%s%s", STAMP_FILE_PRE, active_interface); + stamp_file = strdup (temp); + } + strcpy(temp, "/etc/wmppprc"); parse_rcfile(temp, wmppp_keys); @@ -483,7 +490,7 @@ void wmppp_routine(int argc, char **argv) { if (!starttime) { starttime = currenttime; - if (stat(STAMP_FILE, &st) == 0) + if (stat(stamp_file, &st) == 0) starttime = st.st_mtime; SetOnLED(LED_PPP_POWER);