[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9503: Remove a now-bogus assert() from nt_service_command_line(), (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9503: Remove a now-bogus assert() from nt_service_command_line(), (in tor/trunk: . src/or)
- From: nickm@xxxxxxxx
- Date: Tue, 6 Feb 2007 17:00:27 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 06 Feb 2007 17:00:46 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2007-02-06 17:00:25 -0500 (Tue, 06 Feb 2007)
New Revision: 9503
Modified:
tor/trunk/
tor/trunk/src/or/main.c
Log:
r11674@catbus: nickm | 2007-02-06 17:00:22 -0500
Remove a now-bogus assert() from nt_service_command_line(), and change option handling. (Now that we no longer force a -f, it is possible to have no command-line options for Tor-as-service.)
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r11674] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c 2007-02-06 18:36:26 UTC (rev 9502)
+++ tor/trunk/src/or/main.c 2007-02-06 22:00:25 UTC (rev 9503)
@@ -2096,8 +2096,7 @@
nt_service_command_line(int *using_default_torrc)
{
TCHAR tor_exe[MAX_PATH+1];
- char *command, *options;
- const char *torrc;
+ char *command, *options=NULL;
smartlist_t *sl;
int i, cmdlen;
*using_default_torrc = 1;
@@ -2108,7 +2107,6 @@
/* Get the service arguments */
sl = smartlist_create();
- torrc = get_torrc_fname();
for (i = 1; i < backup_argc; ++i) {
if (!strcmp(backup_argv[i], "--options") ||
!strcmp(backup_argv[i], "-options")) {
@@ -2119,8 +2117,8 @@
}
}
}
- tor_assert(smartlist_len(sl));
- options = smartlist_join_strings(sl,"\" \"",0,NULL);
+ if (smartlist_len(sl))
+ options = smartlist_join_strings(sl,"\" \"",0,NULL);
smartlist_free(sl);
/* Allocate a string for the NT service command line */
@@ -2128,10 +2126,17 @@
command = tor_malloc(cmdlen);
/* Format the service command */
- if (tor_snprintf(command, cmdlen, "\"%s\" --nt-service \"%s\"",
- tor_exe, options)<0) {
- tor_free(command); /* sets command to NULL. */
+ if (options) {
+ if (tor_snprintf(command, cmdlen, "\"%s\" --nt-service \"%s\"",
+ tor_exe, options)<0) {
+ tor_free(command); /* sets command to NULL. */
+ }
+ } else { /* ! options */
+ if (tor_snprintf(command, cmdlen, "\"%s\" --nt-service", tor_exe)<0) {
+ tor_free(command); /* sets command to NULL. */
+ }
}
+
tor_free(options);
return command;
}