208-fix_status_code.patch 771 B

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