mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
create the pidfile and store the pid on invoke
This commit is contained in:
parent
b32a39f44f
commit
2e9a798f09
@ -299,6 +299,7 @@ int main(int argc, char *argv[])
|
|||||||
unsigned short port = DEFAULT_PORT;
|
unsigned short port = DEFAULT_PORT;
|
||||||
char *logfile = DEFAULT_LOGFILE;
|
char *logfile = DEFAULT_LOGFILE;
|
||||||
int part_no;
|
int part_no;
|
||||||
|
FILE *pidfile;
|
||||||
|
|
||||||
if(argc>1)
|
if(argc>1)
|
||||||
port = atoi(argv[1]);
|
port = atoi(argv[1]);
|
||||||
@ -345,10 +346,18 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
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 */
|
/* start accepting connections */
|
||||||
listen(sock, 5);
|
listen(sock, 5);
|
||||||
|
|
||||||
printf("*** %s listening on port %u ***\n", VERSION, port);
|
fprintf(stderr, "*** %s listening on port %u ***\n", VERSION, port);
|
||||||
|
|
||||||
while (!sigterm) {
|
while (!sigterm) {
|
||||||
int doc;
|
int doc;
|
||||||
|
Loading…
Reference in New Issue
Block a user