ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/ihost/ihost.c
(Generate patch)

Comparing projects/cms/source/ihost/ihost.c (file contents):
Revision 1.33 by pajs, Sat Mar 8 20:41:46 2003 UTC vs.
Revision 1.40 by pajs, Sun Apr 6 12:08:37 2003 UTC

# Line 31 | Line 31
31   #include <stdarg.h>
32   #include <errno.h>
33   #include <netdb.h>
34 + #include <netinet/in.h>
35  
36 < #include "ukcprog.h"
37 < #include "statgrab.h"
36 > #include <ukcprog.h>
37 > #include <statgrab.h>
38  
39   #define LOG_CRIT 0
40   #define LOG_ERR 1
# Line 77 | Line 78 | ihost_config_t ihost_config;
78  
79   extern int errno;
80  
81 < /* Taken from the openssh code. Its licence included in function.*/
82 < //#ifndef HAVE_STRLCAT
81 > /* Taken from the OpenSSH code. Its licence included in function.*/
82 > #ifndef HAVE_STRLCAT
83  
84   /*
85   * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
# Line 106 | Line 107 | extern int errno;
107   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
108   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
109   */
110 +
111   /*
112   * Appends src to string dst of size siz (unlike strncat, siz is the
113   * full size of dst, not space left).  At most siz-1 characters
# Line 144 | Line 146 | strlcat(dst, src, siz)
146          return(dlen + (s - src));       /* count does not include NUL */
147   }
148  
149 < //#endif
149 > #endif
150 > /* End strlcat function taken from OpenSSH */
151  
149
152   void log_msg(int level, char *format, ...){
153          int cur_errno;
154          va_list ap;
# Line 162 | Line 164 | void log_msg(int level, char *format, ...){
164                  }else{
165                          fprintf(ihost_config.log, "\n");
166                  }
167 +                fflush(ihost_config.log);
168          }
169   }
170  
# Line 221 | Line 224 | FILE *create_tcp_connection(char *hostname, int port){
224  
225          if((get_host_addr(hostname, &haddr))!=0){
226                  log_msg(LOG_CRIT, "Failed to lookup name for %s", hostname);
227 +                close(sock);
228                  return NULL;
229          }
230  
# Line 232 | Line 236 | FILE *create_tcp_connection(char *hostname, int port){
236          log_msg(LOG_DEBUG, "Creating a tcp connection");
237          if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) !=0){
238                  log_msg(LOG_CRIT, "Failed to connect to hostname %s on port %d", hostname, port);
239 +                close(sock);
240                  return NULL;
241          }
242  
# Line 292 | Line 297 | int ihost_getconfig(ihost_state_t *ihost_state){
297          time_t config_ttl=0;
298  
299          if((tcp_con=create_tcp_connection(ihost_state->filtermanager_host, ihost_state->filtermanager_port))==NULL){
300 <                goto error;
300 >                return -1;
301          }
302  
303          if(ihost_state->file_list!=NULL || ihost_state->last_modified!=NULL){
# Line 577 | Line 582 | int get_system_stats(int seq_no, ihost_state_t *ihost_
582                          y=page_stats->pages_pageout;
583                  }
584                  snprintf(tmp, size, \
585 <                        "<pages><swapins>%lld</swapins><swapouts>%lld</swapouts></pages>", \
585 >                        "<pages><pageins>%lld</pageins><pageouts>%lld</pageouts></pages>", \
586                          x, \
587                          y);
588          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines