[tor-commits] [tor/master] Only return 0..255 from main().

nickm at torproject.org nickm at torproject.org
Thu Sep 3 15:38:48 UTC 2015


commit e73206f68184a0d571a875044cf0a2cb6090f454
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Sep 3 11:38:00 2015 -0400

    Only return 0..255 from main().
    
    I think this may fix some bugs with windows exit codes being screwy.
---
 changes/normalize_exit |    3 +++
 src/or/tor_main.c      |    6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/changes/normalize_exit b/changes/normalize_exit
new file mode 100644
index 0000000..636d45a
--- /dev/null
+++ b/changes/normalize_exit
@@ -0,0 +1,3 @@
+  o Minor features:
+    - Try harder to normalize the exit status of the Tor process to the
+      standard-provided range.
diff --git a/src/or/tor_main.c b/src/or/tor_main.c
index af03b8c..65bb020 100644
--- a/src/or/tor_main.c
+++ b/src/or/tor_main.c
@@ -27,6 +27,10 @@ int tor_main(int argc, char *argv[]);
 int
 main(int argc, char *argv[])
 {
-  return tor_main(argc, argv);
+  int r = tor_main(argc, argv);
+  if (r < 0 || r > 255)
+    return 1;
+  else
+    return r;
 }
 



More information about the tor-commits mailing list