Fix --listen option to allow other ports
authorIan Price <ianprice90@googlemail.com>
Sat, 10 Sep 2011 02:02:32 +0000 (03:02 +0100)
committerAndy Wingo <wingo@pobox.com>
Sat, 10 Sep 2011 18:06:32 +0000 (11:06 -0700)
* module/ice-9/command-line.scm (compile-shell-switches): Fix
  off-by-one error in 'substring', and swap branches of conditional.

module/ice-9/command-line.scm

index 706948f..8aed74e 100644 (file)
@@ -331,15 +331,15 @@ If FILE begins with `-' the -s switch is mandatory.
             (parse
              args
              (cons
-              (let ((where (substring arg 8)))
+              (let ((where (substring arg 9)))
                 (cond
                  ((string->number where) ; --listen=PORT
                   => (lambda (port)
                        (if (and (integer? port) (exact? port) (>= port 0))
-                           (error "invalid port for --listen")
                            `(@@ (system repl server)
                                 (spawn-server
-                                 (make-tcp-server-socket #:port ,port))))))
+                                 (make-tcp-server-socket #:port ,port)))
+                           (error "invalid port for --listen"))))
                  ((string-prefix? "/" where) ; --listen=/PATH/TO/SOCKET
                   `(@@ (system repl server)
                        (spawn-server