packages: sort network related packages into package/network/
[openwrt.git] / package / network / services / ppp / patches / 208-fix_status_code.patch
1 pppd: Do not clobber exit codes on hangup
2
3 When a modem hangup occurs, pppd unconditionally sets the exit status code
4 to EXIT_HANGUP. This patch only sets EXIT_HANGUP if the exit status code is
5 not already set to an error value.
6
7 The motiviation of this patch is to allow applications which remote control
8 pppd to react properly on errors, e.g. only redial (relaunch pppd) if there
9 was a hangup, but not if the CHAP authentication failed.
10
11 Signed-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;