]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
create the pidfile and store the pid on invoke
authorDaniel Stenberg <daniel@haxx.se>
Mon, 25 Feb 2002 10:27:29 +0000 (10:27 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 25 Feb 2002 10:27:29 +0000 (10:27 +0000)
tests/server/sws.c

index 6b6585007322fd8b40c23d4dd219579011a89d16..9c76b51555959cb1502de2d192d915f7288c0fd4 100644 (file)
@@ -299,6 +299,7 @@ int main(int argc, char *argv[])
   unsigned short port = DEFAULT_PORT;
   char *logfile = DEFAULT_LOGFILE;
   int part_no;
+  FILE *pidfile;
   
   if(argc>1)
     port = atoi(argv[1]);
@@ -345,10 +346,18 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
+  pidfile = fopen(".http.pid", "w");
+  if(pidfile) {
+    fprintf(pidfile, "%d\n", (int)getpid());
+    fclose(pidfile);
+  }
+  else
+    fprintf(stderr, "Couldn't write pid file\n");
+
   /* start accepting connections */
   listen(sock, 5);
 
-  printf("*** %s listening on port %u ***\n", VERSION, port);
+  fprintf(stderr, "*** %s listening on port %u ***\n", VERSION, port);
 
   while (!sigterm) {
     int doc;