summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-09-24 15:59:01 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-09-24 15:59:01 +0000
commitb092b4ea23a50981dc2957967224495ddb69c00e (patch)
tree9c1a966f4ca84a9c43860e8c9755ed87eada3182
parent36d36419b3d83311cd44c8c8e0d6a94b803d569b (diff)
BUILD : 1.7.15 (1157) BUGS : 589 NOTES : Fixed restarting under windows, it should now work correctly
git-svn-id: svn://svn.anope.org/anope/trunk@1157 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@880 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes1
-rw-r--r--src/main.c68
-rw-r--r--version.log6
3 files changed, 57 insertions, 18 deletions
diff --git a/Changes b/Changes
index d9e091b37..3e7aa6278 100644
--- a/Changes
+++ b/Changes
@@ -13,6 +13,7 @@ Provided by Anope Dev. <dev@anope.org> - 2006
09/10 F Nick Enforcers can now be whois'd on services. [#601]
09/10 F Corrected valid nick characters for /OS SVSNICK. [#599]
09/17 F Small mistakes in Dutch language file. [ #00]
+09/23 F Restarting under Windows now works correctly [#589]
Provided by Trystan <trystan@nomadirc.net> - 2006
08/20 F Fixed several compiler warnings. [#586]
diff --git a/src/main.c b/src/main.c
index 2c05f8a86..9bc364989 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,6 +46,10 @@ int nothird = 0; /* -nothrid */
int noexpire = 0; /* -noexpire */
int protocoldebug = 0; /* -protocoldebug */
+#ifdef _WIN32
+char *binary_dir; /* Used to store base path for win32 restart */
+#endif
+
#ifdef USE_RDB
int do_mysql = 0; /* use mysql ? */
#endif
@@ -228,6 +232,12 @@ static void services_restart(void)
/* First don't unload protocol module, then do so */
modules_unload_all(true, false);
modules_unload_all(true, true);
+#ifdef _WIN32
+ /* This fixes bug #589 - change to binary directory for restart */
+ /* -- heinz */
+ if (binary_dir)
+ chdir(binary_dir);
+#endif
execve(SERVICES_BIN, my_av, my_envp);
if (!readonly) {
open_log();
@@ -403,13 +413,13 @@ void sighandler(int signum)
snprintf(buf, sizeof(buf), "saving %s", ExceptionDBName);
break;
case -19:
- snprintf(buf, sizeof(buf), "Sending event %s %s",
+ snprintf(buf, sizeof(buf), "Sending event %s %s",
EVENT_DB_SAVING, EVENT_START);
- break;
- case -20:
- snprintf(buf, sizeof(buf), "Sending event %s %s",
+ break;
+ case -20:
+ snprintf(buf, sizeof(buf), "Sending event %s %s",
EVENT_DB_SAVING, EVENT_STOP);
- break;
+ break;
case -21:
snprintf(buf, sizeof(buf), "expiring nicknames");
break;
@@ -429,16 +439,16 @@ void sighandler(int signum)
snprintf(buf, sizeof(buf), "expiring SQLINEs");
break;
case -29:
- snprintf(buf, sizeof(buf), "expiring Exceptions");
- break;
- case -30:
- snprintf(buf, sizeof(buf), "Sending event %s %s",
+ snprintf(buf, sizeof(buf), "expiring Exceptions");
+ break;
+ case -30:
+ snprintf(buf, sizeof(buf), "Sending event %s %s",
EVENT_DB_EXPIRE, EVENT_START);
- break;
- case -31:
- snprintf(buf, sizeof(buf), "Sending event %s %s",
+ break;
+ case -31:
+ snprintf(buf, sizeof(buf), "Sending event %s %s",
EVENT_DB_EXPIRE, EVENT_STOP);
- break;
+ break;
default:
snprintf(buf, sizeof(buf), "waiting=%d", waiting);
}
@@ -510,6 +520,18 @@ int main(int ac, char **av, char **envp)
" require root privileges to run, and it is discouraged that you run Anope\n");
fprintf(stderr, " as the root superuser.\n");
}
+#else
+ /*
+ * We need to know which directory we're in for when restart is called.
+ * This only affects Windows as a full path is not specified in services_dir.
+ * This fixes bug #589.
+ * -- heinz
+ */
+ binary_dir = smalloc(MAX_PATH);
+ if (!getcwd(binary_dir, MAX_PATH)) {
+ fprintf(stderr, "error: getcwd() error\n");
+ return -1;
+ }
#endif
/* General initialization first */
@@ -633,6 +655,12 @@ int main(int ac, char **av, char **envp)
anope_cmd_squit(ServerName, quitmsg);
disconn(servsock);
close_log();
+#ifdef _WIN32
+ /* This fixes bug #589 - change to binary directory for restart */
+ /* -- heinz */
+ if (binary_dir)
+ chdir(binary_dir);
+#endif
execve(SERVICES_BIN, av, envp);
if (!readonly) {
open_log();
@@ -648,6 +676,12 @@ int main(int ac, char **av, char **envp)
/* Disconnect and exit */
services_shutdown();
+
+#ifdef _WIN32
+ if (binary_dir)
+ free(binary_dir);
+#endif
+
return 0;
}
@@ -680,9 +714,9 @@ void do_backtrace(int show_segheader)
#endif
#else
char *winver;
- winver = GetWindowsVersion();
- alog("Backtrace: not available on Windows");
- alog("Running %S", winver);
- free(winver);
+ winver = GetWindowsVersion();
+ alog("Backtrace: not available on Windows");
+ alog("Running %S", winver);
+ free(winver);
#endif
}
diff --git a/version.log b/version.log
index 710fdd0ab..ad790ce8b 100644
--- a/version.log
+++ b/version.log
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="15"
VERSION_EXTRA="-svn"
-VERSION_BUILD="1156"
+VERSION_BUILD="1157"
# $Log$
#
+# BUILD : 1.7.15 (1157)
+# BUGS : 589
+# NOTES : Fixed restarting under windows, it should now work correctly
+#
# BUILD : 1.7.15 (1156)
# BUGS :
# NOTES : Another small fix in nl.l