Root/package/network/services/ppp/patches/208-fix_status_code.patch

1pppd: Do not clobber exit codes on hangup
2
3When a modem hangup occurs, pppd unconditionally sets the exit status code
4to EXIT_HANGUP. This patch only sets EXIT_HANGUP if the exit status code is
5not already set to an error value.
6
7The motiviation of this patch is to allow applications which remote control
8pppd to react properly on errors, e.g. only redial (relaunch pppd) if there
9was a hangup, but not if the CHAP authentication failed.
10
11Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
12
13--- a/pppd/main.c
14+++ b/pppd/main.c
15@@ -1048,7 +1048,8 @@ get_input()
16     }
17     notice("Modem hangup");
18     hungup = 1;
19- status = EXIT_HANGUP;
20+ if (status == EXIT_OK)
21+ status = EXIT_HANGUP;
22     lcp_lowerdown(0); /* serial link is no longer available */
23     link_terminated(0);
24     return;
25

Archive Download this file



interactive