summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-10-01 23:48:46 -0400
committerAdam <Adam@anope.org>2013-10-05 00:33:03 -0400
commit353ee5cc933b96e92fad807a784ba40505e95a00 (patch)
treee3cfba4a40cff01e0cc907ff20a0a3638ad3a6c4 /src
parentb094132c9d1dff2869efd70f3d6f8d1654331780 (diff)
Fix xline uid generation when the one chosen already exists
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp2
-rw-r--r--src/xline.cpp6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp
index dbcdea02c..fae776f9b 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -447,7 +447,7 @@ void Anope::Init(int ac, char **av)
/* Initialize random number generator */
block = Config->GetBlock("options");
- srand(block->Get<unsigned>("seed"));
+ srand(block->Get<unsigned>("seed") ^ time(NULL));
/* load modules */
Log() << "Loading modules...";
diff --git a/src/xline.cpp b/src/xline.cpp
index 554632a38..a5087109c 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -220,11 +220,12 @@ Anope::string XLineManager::GenerateUID()
{
Anope::string id;
int count = 0;
- while (id.empty() || XLinesByUID->count(id) > 0)
+ do
{
+ id.clear();
+
if (++count > 10)
{
- id.clear();
Log(LOG_DEBUG) << "Unable to generate XLine UID";
break;
}
@@ -238,6 +239,7 @@ Anope::string XLineManager::GenerateUID()
id += c;
}
}
+ while (XLinesByUID->count(id) > 0);
return id;
}