/* $Core */
+#ifdef _WIN32
+#define _CRT_RAND_S
+#include <stdlib.h>
+#endif
+
#include "inspircd.h"
#include "xline.h"
#include "exitcodes.h"
+#include <iostream>
std::string InspIRCd::GetServerDescription(const std::string& servername)
{
if (!Config->cmdline.writelog) return true; // Skip opening default log if -nolog
if (Config->cmdline.startup_log.empty())
- Config->cmdline.startup_log = "logs/startup.log";
+ Config->cmdline.startup_log = LOG_PATH "/startup.log";
FILE* startup = fopen(Config->cmdline.startup_log.c_str(), "a+");
if (!startup)
void InspIRCd::CheckRoot()
{
+#ifndef _WIN32
if (geteuid() == 0)
{
- printf("WARNING!!! You are running an irc server as ROOT!!! DO NOT DO THIS!!!\n\n");
- this->Logs->Log("STARTUP",DEFAULT,"Cant start as root");
+ std::cout << "ERROR: You are running an irc server as root! DO NOT DO THIS!" << std::endl << std::endl;
+ this->Logs->Log("STARTUP",DEFAULT,"Can't start as root");
Exit(EXIT_STATUS_ROOT);
}
+#endif
}
void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const std::string &text)
void GenRandomHandler::Call(char *output, size_t max)
{
for(unsigned int i=0; i < max; i++)
+#ifdef _WIN32
+ {
+ unsigned int uTemp;
+ if(rand_s(&uTemp) != 0)
+ output[i] = rand();
+ else
+ output[i] = uTemp;
+ }
+#else
output[i] = random();
+#endif
}
ModResult OnCheckExemptionHandler::Call(User* user, Channel* chan, const std::string& restriction)