]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make ntmain.h functions stubs when NT_SERVICE not enabled.
authorNick Mathewson <nickm@torproject.org>
Mon, 6 Jan 2020 14:19:09 +0000 (09:19 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 6 Jan 2020 14:25:23 +0000 (09:25 -0500)
This lets us simplify main.c a little, and avoid a practracker
exception.

Followup from #32883.

src/app/main/main.c
src/app/main/ntmain.h

index 2a5cb4aa071b970c698563148bda96f3e43ccbe8..9c60d3c0f5f45959e80cb063d732955b85c59e8a 100644 (file)
@@ -1238,15 +1238,10 @@ tor_run_main(const tor_main_configuration_t *tor_cfg)
     memcpy(argv + tor_cfg->argc, tor_cfg->argv_owned,
            tor_cfg->argc_owned*sizeof(char*));
 
-#ifdef NT_SERVICE
-  {
-     int done = 0;
-     result = nt_service_parse_options(argc, argv, &done);
-     if (done) {
-       goto done;
-     }
-  }
-#endif /* defined(NT_SERVICE) */
+  int done = 0;
+  result = nt_service_parse_options(argc, argv, &done);
+  if (done)
+    goto done;
 
   pubsub_install();
 
@@ -1288,9 +1283,7 @@ tor_run_main(const tor_main_configuration_t *tor_cfg)
 
   switch (get_options()->command) {
   case CMD_RUN_TOR:
-#ifdef NT_SERVICE
     nt_service_set_state(SERVICE_RUNNING);
-#endif
     result = run_tor_main_loop();
     break;
   case CMD_KEYGEN:
index c39386c0544c8c558f5ab20663d8650b338741d5..e23641bffa6e9c565d7909b96350bb616c833cd1 100644 (file)
@@ -22,7 +22,8 @@ int nt_service_is_stopping(void);
 void nt_service_set_state(DWORD state);
 #else
 #define nt_service_is_stopping() 0
+#define nt_service_parse_options(a, b, c) (0)
+#define nt_service_set_state(s) STMT_NIL
 #endif /* defined(NT_SERVICE) */
 
 #endif /* !defined(TOR_NTMAIN_H) */
-