Bug 5977 - --pidfile option doesn't work
: --pidfile option doesn't work
Status: CLOSED FIXED
: ALT Linux 2.4
(All bugs in ALT Linux 2.4/pptpd)
: 2.4
: all Linux
: P2 normal
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2005-01-27 09:27 by
Modified: 2005-07-13 15:47 (History)


Attachments
моя версия патча (865 bytes, patch)
2005-02-07 17:45, Denis Ovsienko
no flags Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-01-27 09:27:09
--pidfile options for pptpd doesn't work, it always create default pidfile /var/
run/pptpd.pid
error in pptpd.c, function log_pid
here is small patch
--------------------------------------------------------------------------
--- poptop-1.1.4.orig/pptpd.c   2003-02-27 15:01:10 +0500
+++ poptop-1.1.4/pptpd.c        2005-01-27 11:02:22 +0500
@@ -76,7 +76,7 @@
 static void my_daemon(int argc, char **argv);
 #endif

-static void log_pid();
+static void log_pid(char *pid_file);
 static char *lookup(char *);

 static void showusage(char *prog)
@@ -347,21 +347,20 @@
        ledman_cmd(LEDMAN_CMD_ON, LEDMAN_VPN);
 #endif
        /* after we have our final pid... */
-       log_pid();
-
+       log_pid(pid_file);
+
        pptp_manager(argc, argv);
        return 1;
 }

-static void log_pid() {
+static void log_pid(char *pid_file) {
         FILE    *f;
         pid_t   pid;
-        char    *pidfile = "/var/run/pptpd.pid";

         pid = getpid();
-        if ((f = fopen(pidfile, "w")) == NULL) {
+        if ((f = fopen(pid_file, "w")) == NULL) {
                 syslog(LOG_ERR, "PPTPD: failed to open(%s), errno=%d\n",
-                        pidfile, errno);
+                        pid_file, errno);
                 return;
         }
         fprintf(f, "%d\n", pid);
--------------------------------------------------------------------------
------- Comment #1 From 2005-02-07 17:45:28 -------
Created an attachment (id=722) [details]
моя версия патча

Я думаю, будет лучше в таком виде.
------- Comment #2 From 2005-02-07 17:46:33 -------
Реализовано в pptpd-1.1.4-alt4.b4
------- Comment #3 From 2005-02-07 19:21:25 -------
(In reply to comment #1)
> Created an attachment (id=722) [edit] [details]
> моя версия патча
> Я думаю, будет лучше в таком виде.

Да, так оно лучше.

По большому счету надо бы "/var/run/pptpd.pid" вообще в define вынести...