Skip to content
Snippets Groups Projects
Commit 2e9a798f authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

create the pidfile and store the pid on invoke

parent b32a39f4
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment