]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Only return 0..255 from main().
authorNick Mathewson <nickm@torproject.org>
Thu, 3 Sep 2015 15:38:00 +0000 (11:38 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 3 Sep 2015 15:38:00 +0000 (11:38 -0400)
I think this may fix some bugs with windows exit codes being screwy.

changes/normalize_exit [new file with mode: 0644]
src/or/tor_main.c

diff --git a/changes/normalize_exit b/changes/normalize_exit
new file mode 100644 (file)
index 0000000..636d45a
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor features:
+    - Try harder to normalize the exit status of the Tor process to the
+      standard-provided range.
index af03b8c06aebed176de34290ff0c06da3927beab..65bb020c2c68f4c99b19845f8a82aab7df3f562e 100644 (file)
@@ -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;
 }