12_all_linkpidfile.patch 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. diff -Nru ppp-2.4.5.orig/pppd/auth.c ppp-2.4.5/pppd/auth.c
  2. --- ppp-2.4.5.orig/pppd/auth.c 2009-11-16 23:26:07.000000000 +0100
  3. +++ ppp-2.4.5/pppd/auth.c 2010-08-08 09:57:01.000000000 +0200
  4. @@ -637,7 +637,7 @@
  5. * we delete its pid file.
  6. */
  7. if (!doing_multilink && !demand)
  8. - remove_pidfiles();
  9. + remove_pidfile(pidfilename);
  10. /*
  11. * If we may want to bring the link up again, transfer
  12. diff -Nru ppp-2.4.5.orig/pppd/main.c ppp-2.4.5/pppd/main.c
  13. --- ppp-2.4.5.orig/pppd/main.c 2010-08-08 09:46:42.000000000 +0200
  14. +++ ppp-2.4.5/pppd/main.c 2010-08-08 09:57:01.000000000 +0200
  15. @@ -134,7 +134,7 @@
  16. char *progname; /* Name of this program */
  17. char hostname[MAXNAMELEN]; /* Our hostname */
  18. -static char pidfilename[MAXPATHLEN]; /* name of pid file */
  19. +char pidfilename[MAXPATHLEN]; /* name of pid file */
  20. static char linkpidfile[MAXPATHLEN]; /* name of linkname pid file */
  21. char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
  22. uid_t uid; /* Our real user-id */
  23. @@ -245,6 +245,7 @@
  24. static void toggle_debug __P((int));
  25. static void open_ccp __P((int));
  26. static void bad_signal __P((int));
  27. +static void remove_pidfilenames __P((void));
  28. static void holdoff_end __P((void *));
  29. static void forget_child __P((int pid, int status));
  30. static int reap_kids __P((void));
  31. @@ -835,16 +836,24 @@
  32. }
  33. /*
  34. - * remove_pidfile - remove our pid files
  35. + * remove_pidfile - remove one of the 2 pidfiles (pidfilename or linkpidfile)
  36. */
  37. -void remove_pidfiles()
  38. +void
  39. +remove_pidfile(filename)
  40. + char* filename;
  41. {
  42. - if (pidfilename[0] != 0 && unlink(pidfilename) < 0 && errno != ENOENT)
  43. - warn("unable to delete pid file %s: %m", pidfilename);
  44. - pidfilename[0] = 0;
  45. - if (linkpidfile[0] != 0 && unlink(linkpidfile) < 0 && errno != ENOENT)
  46. - warn("unable to delete pid file %s: %m", linkpidfile);
  47. - linkpidfile[0] = 0;
  48. + if (filename[0] != 0 && unlink(filename) < 0 && errno != ENOENT)
  49. + warn("unable to delete pid file %s: %m", filename);
  50. + filename[0] = 0;
  51. +}
  52. +
  53. +/*
  54. + * remove_pidfiles - remove our pid files
  55. + */
  56. +static void remove_pidfiles()
  57. +{
  58. + remove_pidfile(pidfilename);
  59. + remove_pidfile(linkpidfile);
  60. }
  61. /*
  62. diff -Nru ppp-2.4.5.orig/pppd/multilink.c ppp-2.4.5/pppd/multilink.c
  63. --- ppp-2.4.5.orig/pppd/multilink.c 2009-11-16 23:26:07.000000000 +0100
  64. +++ ppp-2.4.5/pppd/multilink.c 2010-08-08 09:57:01.000000000 +0200
  65. @@ -267,7 +267,7 @@
  66. notice("Connection terminated.");
  67. print_link_stats();
  68. if (!demand) {
  69. - remove_pidfiles();
  70. + remove_pidfile(pidfilename);
  71. script_unsetenv("IFNAME");
  72. }
  73. diff -Nru ppp-2.4.5.orig/pppd/pppd.h ppp-2.4.5/pppd/pppd.h
  74. --- ppp-2.4.5.orig/pppd/pppd.h 2010-08-08 09:44:29.000000000 +0200
  75. +++ ppp-2.4.5/pppd/pppd.h 2010-08-08 09:57:01.000000000 +0200
  76. @@ -214,6 +214,7 @@
  77. extern int ifunit; /* Interface unit number */
  78. extern char ifname[]; /* Interface name */
  79. extern char hostname[]; /* Our hostname */
  80. +extern char pidfilename[]; /* name of pid file */
  81. extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
  82. extern int devfd; /* fd of underlying device */
  83. extern int fd_ppp; /* fd for talking PPP */
  84. @@ -497,7 +498,7 @@
  85. int ppp_send_config __P((int, int, u_int32_t, int, int));
  86. int ppp_recv_config __P((int, int, u_int32_t, int, int));
  87. const char *protocol_name __P((int));
  88. -void remove_pidfiles __P((void));
  89. +void remove_pidfile __P((char *));
  90. void lock_db __P((void));
  91. void unlock_db __P((void));