diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 4 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index eda78a84b..d6bfb40e6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -3386,6 +3386,10 @@ int InspIRCd(void) Exit(ERROR); } } + + char PID[MAXBUF]; + ConfValue("pid","file",0,PID,&config_f); + WritePID(PID); /* setup select call */ diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 7a2ad99f8..19f853ddb 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -67,6 +67,20 @@ void Start (void) printf("\033[1;37mName concept:\033[0;37m Lord_Zathras\n\n"); } +void WritePID(std::string filename) +{ + ofstream outfile(filename.c_str()); + if (outfile.is_open()) + { + outfile << getpid(); + outfile.close(); + } + else + { + printf("Failed to write PID-file '%s', exiting.\n",filename.c_str()); + Exit(0); + } +} void DeadPipe(int status) { |