IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27988


Ignore:
Timestamp:
May 17, 2010, 5:32:57 PM (16 years ago)
Author:
Paul Price
Message:

Zeroing rfds to avoid "using variable uninitialised" warning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libkapa/src/KapaOpen.c

    r27588 r27988  
    3131  if (status == -1) {
    3232    if (errno == EADDRINUSE) {
    33         close (InitSocket);
    34         Address[0].sin_port ++;
    35         if (Address[0].sin_port > MY_PORT_MAX) exit (2);
    36         goto retry_server;
     33        close (InitSocket);
     34        Address[0].sin_port ++;
     35        if (Address[0].sin_port > MY_PORT_MAX) exit (2);
     36        goto retry_server;
    3737    }
    3838    perror ("bind: ");
     
    6969
    7070  /* do I need to clear rfds on each pass? */
     71  FD_ZERO(&rfds);
    7172  FD_SET (InitSocket, &rfds);
    7273  status = select (InitSocket + 1, &rfds, NULL, NULL, &wait);
     
    9899
    99100  for (i = 0; i < Nvalid; i++) {
    100     /* valid IP addresses may be machines (120.90.121.142) or 
     101    /* valid IP addresses may be machines (120.90.121.142) or
    101102       class C networks (120.90.121.0) */
    102        
     103
    103104    /* for machine, address must match */
    104105    if ((0xff & (VALID[i] >> 24)) != 0) {
     
    138139  test = TRUE;
    139140  test &= (status == 4);
    140   test &= ((ip1 > 0) && (ip1 < 256)); 
    141   test &= ((ip2 > 0) && (ip2 < 256)); 
    142   test &= ((ip3 > 0) && (ip3 < 256)); 
    143   test &= ((ip4 >=0) && (ip4 < 256)); 
     141  test &= ((ip1 > 0) && (ip1 < 256));
     142  test &= ((ip2 > 0) && (ip2 < 256));
     143  test &= ((ip3 > 0) && (ip3 < 256));
     144  test &= ((ip4 >=0) && (ip4 < 256));
    144145  if (!test) {
    145146    fprintf (stderr, "invalid IP address %s\n", string);
     
    205206
    206207  // the client uses a BLOCKing socket by default
    207   fcntl (InitSocket, F_SETFL, !O_NONBLOCK); 
     208  fcntl (InitSocket, F_SETFL, !O_NONBLOCK);
    208209  return (InitSocket);
    209210}
     
    211212int KapaOpen (char *kapa_exec, char *kapa_name) {
    212213
    213   // kapa_exec may be kapa://host, in which case we attempt to connect to an 
     214  // kapa_exec may be kapa://host, in which case we attempt to connect to an
    214215  // already running kapa, or the program path, in which case we are supposed
    215216  // to launch it locally, then connect to it.
     
    265266  unlink (socket_name);
    266267
    267   strcpy (Address.sun_path, socket_name); 
    268   Address.sun_family = AF_UNIX; 
    269   InitSocket = socket (AF_UNIX, SOCK_STREAM, 0); 
     268  strcpy (Address.sun_path, socket_name);
     269  Address.sun_family = AF_UNIX;
     270  InitSocket = socket (AF_UNIX, SOCK_STREAM, 0);
    270271  status = bind (InitSocket, (struct sockaddr *) &Address, sizeof (Address));
    271272  status = listen (InitSocket, 1);
    272  
     273
    273274  if (name == NULL) {
    274275    sprintf (temp, "%s -socket %s &", kapa_exec, socket_name);
     
    282283
    283284  AddressLength =  sizeof (Address);
    284   fcntl (InitSocket, F_SETFL, O_NONBLOCK); 
     285  fcntl (InitSocket, F_SETFL, O_NONBLOCK);
    285286
    286287# define NTRY 500
     
    297298
    298299  // the client uses a BLOCKing socket by default
    299   fcntl (fd, F_SETFL, !O_NONBLOCK); 
     300  fcntl (fd, F_SETFL, !O_NONBLOCK);
    300301  return (fd);
    301302}
     
    317318
    318319  // the server uses an unblocked socket
    319   fcntl (sock, F_SETFL, O_NONBLOCK); 
     320  fcntl (sock, F_SETFL, O_NONBLOCK);
    320321  unlink (sockpath);
    321322  return (sock);
Note: See TracChangeset for help on using the changeset viewer.