summaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
authorAdam <adam@sigterm.info>2012-10-12 14:50:05 -0700
committerAdam <adam@sigterm.info>2012-10-12 14:50:05 -0700
commitc05ad37bfd03486475889485606ed5cffc7bf5a2 (patch)
treefe01825889769500a0f080371a0714aa15505b9a /src/helperfuncs.cpp
parente496d321efe3e9b27f2f116bd22a05ec44aec564 (diff)
parent5b9682275e384635a1fd9f7320cf4d9a604a43b4 (diff)
Merge pull request #320 from ChrisTX/insp20+cleanupwin
Windows: In-depth cleanup (see details)
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r--src/helperfuncs.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 4605092a1..7351a07de 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -24,6 +24,11 @@
/* $Core */
+#ifdef _WIN32
+#define _CRT_RAND_S
+#include <stdlib.h>
+#endif
+
#include "inspircd.h"
#include "xline.h"
#include "exitcodes.h"
@@ -311,12 +316,14 @@ bool InspIRCd::OpenLog(char**, int)
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");
Exit(EXIT_STATUS_ROOT);
}
+#endif
}
void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const std::string &text)
@@ -451,7 +458,17 @@ unsigned long InspIRCd::GenRandomInt(unsigned long max)
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)