diff --git a/contrib/hg-ssh b/contrib/hg-ssh
index 19379226dc67ef292e01d90082340ff696783ca7_Y29udHJpYi9oZy1zc2g=..feb1fd2d13a9635561b09df4da378984bd740e9a_Y29udHJpYi9oZy1zc2g= 100755
--- a/contrib/hg-ssh
+++ b/contrib/hg-ssh
@@ -41,7 +41,7 @@
     cmdargv = shlex.split(orig_cmd)
 except ValueError, e:
     sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
-    sys.exit(-1)
+    sys.exit(255)
 
 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']:
     path = cmdargv[2]
@@ -50,6 +50,6 @@
         dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio']))
     else:
         sys.stderr.write('Illegal repository "%s"\n' % repo)
-        sys.exit(-1)
+        sys.exit(255)
 else:
     sys.stderr.write('Illegal command "%s"\n' % orig_cmd)
@@ -54,4 +54,4 @@
 else:
     sys.stderr.write('Illegal command "%s"\n' % orig_cmd)
-    sys.exit(-1)
+    sys.exit(255)