/[cvs]/ccvs/src/buffer.c
ViewVC logotype

Diff of /ccvs/src/buffer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21.4.13 by scjones, Fri Sep 2 19:37:33 2005 UTC revision 1.21.4.14 by mdb, Wed Dec 7 08:04:48 2005 UTC
# Line 1422  stdio_buffer_shutdown (buf) Line 1422  stdio_buffer_shutdown (buf)
1422  {  {
1423      struct stdio_buffer_closure *bc = buf->closure;      struct stdio_buffer_closure *bc = buf->closure;
1424      struct stat s;      struct stat s;
1425      int closefp = 1;      int closefp, statted;
1426    
1427      /* Must be a pipe or a socket.  What could go wrong? */      /* Must be a pipe or a socket. What could go wrong?
1428      assert (fstat (fileno (bc->fp), &s) != -1);       * Well, apparently for disconnected clients under AIX, the
1429         * fstat() will return -1 on the server if the client has gone
1430         * away.
1431         */
1432        if (fstat(fileno(bc->fp), &s) == -1) statted = 0;
1433        else statted = 1;
1434        closefp = statted;
1435    
1436      /* Flush the buffer if we can */      /* Flush the buffer if we can */
1437      if (buf->flush)      if (buf->flush)
# Line 1448  stdio_buffer_shutdown (buf) Line 1454  stdio_buffer_shutdown (buf)
1454  # ifndef NO_SOCKET_TO_FD  # ifndef NO_SOCKET_TO_FD
1455          {          {
1456              /* shutdown() sockets */              /* shutdown() sockets */
1457              if (S_ISSOCK (s.st_mode))              if (statted && S_ISSOCK (s.st_mode))
1458                  shutdown (fileno (bc->fp), 0);                  shutdown (fileno (bc->fp), 0);
1459          }          }
1460  # endif /* NO_SOCKET_TO_FD */  # endif /* NO_SOCKET_TO_FD */
# Line 1456  stdio_buffer_shutdown (buf) Line 1462  stdio_buffer_shutdown (buf)
1462          /* Can't be set with SHUTDOWN_SERVER defined */          /* Can't be set with SHUTDOWN_SERVER defined */
1463          else if (pclose (bc->fp) == EOF)          else if (pclose (bc->fp) == EOF)
1464          {          {
1465              error (1, errno, "closing connection to %s",              error (0, errno, "closing connection to %s",
1466                     current_parsed_root->hostname);                     current_parsed_root->hostname);
1467              closefp = 0;              closefp = 0;
1468          }          }
# Line 1476  stdio_buffer_shutdown (buf) Line 1482  stdio_buffer_shutdown (buf)
1482  # endif  # endif
1483  # ifndef NO_SOCKET_TO_FD  # ifndef NO_SOCKET_TO_FD
1484          /* shutdown() sockets */          /* shutdown() sockets */
1485          if (S_ISSOCK (s.st_mode))          if (statted && S_ISSOCK (s.st_mode))
1486              shutdown (fileno (bc->fp), 1);              shutdown (fileno (bc->fp), 1);
1487  # else  # else
1488          {          {
# Line 1489  stdio_buffer_shutdown (buf) Line 1495  stdio_buffer_shutdown (buf)
1495          buf->output = NULL;          buf->output = NULL;
1496      }      }
1497    
1498      if (closefp && fclose (bc->fp) == EOF)      if (statted && closefp && fclose (bc->fp) == EOF)
1499      {      {
1500          if (server_active)          if (server_active)
1501          {          {
1502              /* Syslog this? */              /* Syslog this? */
1503          }          }
1504  # ifdef CLIENT_SUPPORT  # ifdef CLIENT_SUPPORT
1505            /* We are already closing the connection.
1506             * On error, print a warning and try to
1507             * continue to avoid infinte loops.
1508             */
1509          else          else
1510              error (1, errno,              error (0, errno,
1511                     "closing down connection to %s",                     "closing down connection to %s",
1512                     current_parsed_root->hostname);                     current_parsed_root->hostname);
1513  # endif /* CLIENT_SUPPORT */  # endif /* CLIENT_SUPPORT */
# Line 1511  stdio_buffer_shutdown (buf) Line 1521  stdio_buffer_shutdown (buf)
1521          do          do
1522              w = waitpid (bc->child_pid, (int *) 0, 0);              w = waitpid (bc->child_pid, (int *) 0, 0);
1523          while (w == -1 && errno == EINTR);          while (w == -1 && errno == EINTR);
1524    
1525            /* We are already closing the connection.
1526             * On error, print a warning and try to
1527             * continue to avoid infinte loops.
1528             */
1529          if (w == -1)          if (w == -1)
1530              error (1, errno, "waiting for process %d", bc->child_pid);              error (0, errno, "waiting for process %d", bc->child_pid);
1531      }      }
1532      return 0;      return 0;
1533  }  }

Legend:
Removed from v.1.21.4.13  
changed lines
  Added in v.1.21.4.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26