pcp
[Top] [All Lists]

[PATCH] pidfile change breaks qa test which run non-root pmcd

To: pcp@xxxxxxxxxxx
Subject: [PATCH] pidfile change breaks qa test which run non-root pmcd
From: Michael Newton <kimbrr@xxxxxxx>
Date: Tue, 24 Jul 2007 14:43:37 +1000
Sender: pcp-bounce@xxxxxxxxxxx
in response to nathan's comment..

--- a/mgmt/pcp/src/pmcd/src/pmcd.c      2007-07-24 14:41:58.000000000 +1000
+++ b/mgmt/pcp/src/pmcd/src/pmcd.c      2007-07-24 14:28:57.140447430 +1000
@@ -1206,22 +1206,23 @@
        /*NOTREACHED*/
     }

-    run_dir = pmGetConfig("PCP_RUN_DIR");
-    i = strlen(run_dir);
-    pidpath = malloc(i + strlen(PIDFILE) + 1);
-    memcpy(pidpath, run_dir, i);
-    strcpy(pidpath + i, PIDFILE);
-    pidfile = fopen(pidpath, "w");
-    if (pidfile == NULL) {
-       fprintf(stderr, "Error: Cant open pidfile %s\n", pidpath);
-       DontStart();
-       /*NOTREACHED*/
-    }
-    fprintf(pidfile, "%d", getpid());
-    fflush(pidfile);
-    fclose(pidfile);
-    free(pidpath);
-
+    if (run_daemon) {
+       run_dir = pmGetConfig("PCP_RUN_DIR");
+       i = strlen(run_dir);
+       pidpath = malloc(i + strlen(PIDFILE) + 1);
+       memcpy(pidpath, run_dir, i);
+       strcpy(pidpath + i, PIDFILE);
+       pidfile = fopen(pidpath, "w");
+       if (pidfile == NULL) {
+           fprintf(stderr, "Error: Cant open pidfile %s\n", pidpath);
+           DontStart();
+           /*NOTREACHED*/
+       }
+       fprintf(pidfile, "%d", getpid());
+       fflush(pidfile);
+       fclose(pidfile);
+       free(pidpath);
+    }
     PrintAgentInfo(stderr);
     __pmAccDumpHosts(stderr);
     fprintf(stderr, "\npmcd: PID = %u", (int)getpid());

Dr.Michael("Kimba")Newton  kimbrr@xxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] pidfile change breaks qa test which run non-root pmcd, Michael Newton <=