Skip to content

Commit

Permalink
Merge pull request #1529 from phamvuong/fix_fdselect
Browse files Browse the repository at this point in the history
Call select() before checking active socket
  • Loading branch information
atomicturtle authored Sep 20, 2018
2 parents 45ac04b + fd4ed4e commit e7c8457
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ DEFINES+=-D${uname_S}
# Uncomment the DEFINES statement below if you are
# running Linux and want to use AF_UNSPEC instead of
# AF_INET6 to fully support IPv4 addresses.
#DEFINES+=NOV4MAP
#DEFINES+=-DNOV4MAP

ifneq (,$(filter ${REUSE_ID},yes y Y 1))
DEFINES+=-DREUSE_ID
Expand Down
6 changes: 6 additions & 0 deletions src/os_auth/main-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,12 @@ int main(int argc, char **argv)
memset(&_nc, 0, sizeof(_nc));
_ncl = sizeof(_nc);

fdwork = fdsave;
if (select (fdmax, &fdwork, NULL, NULL, NULL) < 0) {
ErrorExit("ERROR: Call to os_auth select() failed, errno %d - %s",
errno, strerror (errno));
}

/* read through socket list for active socket */
for (sock = 0; sock <= fdmax; sock++) {
if (FD_ISSET (sock, &fdwork)) {
Expand Down

0 comments on commit e7c8457

Please sign in to comment.