mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
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.) svn:r9503
This commit is contained in:
parent
c4faebfa6d
commit
534baec4a1
@ -2096,8 +2096,7 @@ static char *
|
|||||||
nt_service_command_line(int *using_default_torrc)
|
nt_service_command_line(int *using_default_torrc)
|
||||||
{
|
{
|
||||||
TCHAR tor_exe[MAX_PATH+1];
|
TCHAR tor_exe[MAX_PATH+1];
|
||||||
char *command, *options;
|
char *command, *options=NULL;
|
||||||
const char *torrc;
|
|
||||||
smartlist_t *sl;
|
smartlist_t *sl;
|
||||||
int i, cmdlen;
|
int i, cmdlen;
|
||||||
*using_default_torrc = 1;
|
*using_default_torrc = 1;
|
||||||
@ -2108,7 +2107,6 @@ nt_service_command_line(int *using_default_torrc)
|
|||||||
|
|
||||||
/* Get the service arguments */
|
/* Get the service arguments */
|
||||||
sl = smartlist_create();
|
sl = smartlist_create();
|
||||||
torrc = get_torrc_fname();
|
|
||||||
for (i = 1; i < backup_argc; ++i) {
|
for (i = 1; i < backup_argc; ++i) {
|
||||||
if (!strcmp(backup_argv[i], "--options") ||
|
if (!strcmp(backup_argv[i], "--options") ||
|
||||||
!strcmp(backup_argv[i], "-options")) {
|
!strcmp(backup_argv[i], "-options")) {
|
||||||
@ -2119,7 +2117,7 @@ nt_service_command_line(int *using_default_torrc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tor_assert(smartlist_len(sl));
|
if (smartlist_len(sl))
|
||||||
options = smartlist_join_strings(sl,"\" \"",0,NULL);
|
options = smartlist_join_strings(sl,"\" \"",0,NULL);
|
||||||
smartlist_free(sl);
|
smartlist_free(sl);
|
||||||
|
|
||||||
@ -2128,10 +2126,17 @@ nt_service_command_line(int *using_default_torrc)
|
|||||||
command = tor_malloc(cmdlen);
|
command = tor_malloc(cmdlen);
|
||||||
|
|
||||||
/* Format the service command */
|
/* Format the service command */
|
||||||
|
if (options) {
|
||||||
if (tor_snprintf(command, cmdlen, "\"%s\" --nt-service \"%s\"",
|
if (tor_snprintf(command, cmdlen, "\"%s\" --nt-service \"%s\"",
|
||||||
tor_exe, options)<0) {
|
tor_exe, options)<0) {
|
||||||
tor_free(command); /* sets command to NULL. */
|
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);
|
tor_free(options);
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user