diff options
author | Roland McGrath <roland@gnu.org> | 1994-02-14 03:19:45 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1994-02-14 03:19:45 +0000 |
commit | 1d86466f51abf36f87093d685d24e46af53eb752 (patch) | |
tree | c3152e59f3a67d98f16cdd1baf362bcd4e64c147 /manual/examples | |
parent | 5845c6889a34e36e230f5dd028baedbf82becad5 (diff) |
(main): Remove local STATUS. Remember result of accept and add that
(rather than the uninitialized variable STATUS) to ACTIVE_FD_SET.
Diffstat (limited to 'manual/examples')
-rw-r--r-- | manual/examples/inetsrv.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/manual/examples/inetsrv.c b/manual/examples/inetsrv.c index 12619b4067..5bc19fe850 100644 --- a/manual/examples/inetsrv.c +++ b/manual/examples/inetsrv.c @@ -39,7 +39,6 @@ main (void) { extern int make_socket (unsigned short int port); int sock; - int status; fd_set active_fd_set, read_fd_set; int i; struct sockaddr_in clientname; @@ -74,9 +73,10 @@ main (void) if (i == sock) { /* Connection request on original socket. */ + int new; size = sizeof (clientname); - if (accept (sock, - (struct sockaddr *) &clientname, &size) < 0) + new = accept (sock, (struct sockaddr *) &clientname, &size); + if (new < 0) { perror ("accept"); exit (EXIT_FAILURE); @@ -85,7 +85,7 @@ main (void) "Server: connect from host %s, port %hd.\n", inet_ntoa (clientname.sin_addr), ntohs (clientname.sin_port)); - FD_SET (status, &active_fd_set); + FD_SET (new, &active_fd_set); } else { |