Check-in [53db94cd41]
Not logged in
Overview

SHA1 Hash:53db94cd41f9eeaf5e9de68621e327f436d02159
Date: 2008-11-19 23:33:47
User: drh
Comment:Make sure the socket of the "ui" and "server" commands is bound to the specified port when the -P or --port option is used. Ticket 7ef970e4a2
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/cgi.c from [e524bac009] to [ab524199ae].

@@ -1214,11 +1214,11 @@
   struct timeval delay;        /* How long to wait inside select() */
   struct sockaddr_in inaddr;   /* The socket address */
   int opt = 1;                 /* setsockopt flag */
   int iPort = mnPort;
 
-  while( iPort<mxPort ){
+  while( iPort<=mxPort ){
     memset(&inaddr, 0, sizeof(inaddr));
     inaddr.sin_family = AF_INET;
     inaddr.sin_addr.s_addr = INADDR_ANY;
     inaddr.sin_port = htons(iPort);
     listener = socket(AF_INET, SOCK_STREAM, 0);
@@ -1240,11 +1240,11 @@
   if( iPort>mxPort ){
     if( mnPort==mxPort ){
       fossil_fatal("unable to open listening socket on ports %d", mnPort);
     }else{
       fossil_fatal("unable to open listening socket on any"
-                   " ports %d..%d", mnPort, mxPort);
+                   " port in the range %d..%d", mnPort, mxPort);
     }
   }
   if( iPort>mxPort ) return 1;
   listen(listener,10);
   if( iPort>mnPort ){

Modified src/winhttp.c from [dafbf1595e] to [2ef98f5c31].

@@ -144,11 +144,11 @@
   int iPort = mnPort;
 
   if( WSAStartup(MAKEWORD(1,1), &wd) ){
     fossil_fatal("unable to initialize winsock");
   }
-  while( iPort<mxPort ){
+  while( iPort<=mxPort ){
     s = socket(AF_INET, SOCK_STREAM, 0);
     if( s==INVALID_SOCKET ){
       fossil_fatal("unable to create a socket");
     }
     addr.sin_family = AF_INET;
@@ -169,11 +169,11 @@
   if( iPort>mxPort ){
     if( mnPort==mxPort ){
       fossil_fatal("unable to open listening socket on ports %d", mnPort);
     }else{
       fossil_fatal("unable to open listening socket on any"
-                   " ports %d..%d", mnPort, mxPort);
+                   " port in the range %d..%d", mnPort, mxPort);
     }
   }
   zTempPrefix = mprintf("fossil_server_P%d_", iPort);
   printf("Listening for HTTP requests on TCP port %d\n", iPort);
   if( zBrowser ){