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