Bug 5977 - --pidfile option doesn't work
Summary: --pidfile option doesn't work
Status: CLOSED FIXED
Alias: None
Product: ALT Linux 2.4
Classification: Archive
Component: pptpd (show other bugs)
Version: 2.4
Hardware: all Linux
: P2 normal
Assignee: Denis Ovsienko
QA Contact: Andrey Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-27 09:27 MSK by Dmitry Vodennikov
Modified: 2005-07-13 15:47 MSD (History)
0 users

See Also:


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

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Vodennikov 2005-01-27 09:27:09 MSK
--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 Denis Ovsienko 2005-02-07 17:45:28 MSK
Created attachment 722 [details]
моя версия патча

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

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

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