Changeset 16472 for trunk/Ohana/src/opihi/lib.shell/SocketOps.c
- Timestamp:
- Feb 13, 2008, 5:53:35 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/SocketOps.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/SocketOps.c
r12332 r16472 36 36 if (!status) { 37 37 gprint (GP_ERR, "invalid address\n"); 38 exit ( 2);38 exit (4); 39 39 } 40 40 # endif … … 45 45 if (InitSocket == -1) { 46 46 perror ("socket: "); 47 exit ( 2);47 exit (5); 48 48 } 49 49 … … 72 72 if (errno == EADDRINUSE) { 73 73 Address[0].sin_port ++; 74 if (Address[0].sin_port > MY_PORT + 10) exit (2); 74 if (Address[0].sin_port > MY_PORT + 10) { 75 fprintf (stderr, "failed to find a usable port\n"); 76 exit (6); 77 } 75 78 goto retry_server; 76 79 } 77 80 perror ("bind: "); 78 exit ( 2);81 exit (7); 79 82 } 80 83 /* repeated starts of the server are limited by xinetd or something: … … 85 88 if (status == -1) { 86 89 perror ("listen: "); 87 exit ( 2);90 exit (8); 88 91 } 89 92 return (InitSocket); … … 109 112 if (BindSocket == -1) { 110 113 perror ("accept: "); 111 exit ( 2);114 exit (9); 112 115 } 113 116 … … 175 178 if (!status) { 176 179 gprint (GP_ERR, "invalid address\n"); 177 exit ( 2);180 exit (10); 178 181 } 179 182 … … 183 186 if (InitSocket == -1) { 184 187 perror ("socket: "); 185 exit ( 2);188 exit (11); 186 189 } 187 190 … … 190 193 if (errno == ECONNREFUSED) { 191 194 Address.sin_port ++; 192 if (Address.sin_port > MY_PORT + 10) exit ( 2);195 if (Address.sin_port > MY_PORT + 10) exit (12); 193 196 goto retry_client; 194 197 } 195 198 perror ("connect: "); 196 exit ( 2);199 exit (13); 197 200 } 198 201 … … 222 225 if (!status) { 223 226 gprint (GP_ERR, "invalid address\n"); 224 exit ( 2);227 exit (14); 225 228 } 226 229 … … 230 233 if (InitSocket == -1) { 231 234 perror ("socket: "); 232 exit ( 2);235 exit (15); 233 236 } 234 237 … … 237 240 if (status == -1) { 238 241 perror ("bind: "); 239 exit ( 2);242 exit (16); 240 243 } 241 244 … … 243 246 if (status == -1) { 244 247 perror ("listen: "); 245 exit ( 2);248 exit (17); 246 249 } 247 250 … … 269 272 if (!test) { 270 273 gprint (GP_ERR, "invalid IP address %s\n", string); 271 exit ( 2);274 exit (18); 272 275 } 273 276 VALID[Nvalid] = ip1 | (ip2 << 8) | (ip3 << 16) | (ip4 << 24);
Note:
See TracChangeset
for help on using the changeset viewer.
