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.30 by pajs, Mon Mar 3 17:07:34 2003 UTC vs.
Revision 1.35 by pajs, Sun Mar 9 21:04:20 2003 UTC

# Line 75 | Line 75 | typedef struct{
75  
76   ihost_config_t ihost_config;
77  
78 + extern int errno;
79 +
80 + /* Taken from the OpenSSH code. Its licence included in function.*/
81 + #ifndef HAVE_STRLCAT
82 +
83 + /*
84 + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
85 + * All rights reserved.
86 + *
87 + * Redistribution and use in source and binary forms, with or without
88 + * modification, are permitted provided that the following conditions
89 + * are met:
90 + * 1. Redistributions of source code must retain the above copyright
91 + *    notice, this list of conditions and the following disclaimer.
92 + * 2. Redistributions in binary form must reproduce the above copyright
93 + *    notice, this list of conditions and the following disclaimer in the
94 + *    documentation and/or other materials provided with the distribution.
95 + * 3. The name of the author may not be used to endorse or promote products
96 + *    derived from this software without specific prior written permission.
97 + *
98 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
99 + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
100 + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
101 + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
102 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
103 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
104 + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
105 + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
106 + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
107 + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108 + */
109 +
110 + /*
111 + * Appends src to string dst of size siz (unlike strncat, siz is the
112 + * full size of dst, not space left).  At most siz-1 characters
113 + * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
114 + * Returns strlen(src) + MIN(siz, strlen(initial dst)).
115 + * If retval >= siz, truncation occurred.
116 + */
117 + size_t
118 + strlcat(dst, src, siz)
119 +        char *dst;
120 +        const char *src;
121 +        size_t siz;
122 + {
123 +        register char *d = dst;
124 +        register const char *s = src;
125 +        register size_t n = siz;
126 +        size_t dlen;
127 +
128 +        /* Find the end of dst and adjust bytes left but don't go past end */
129 +        while (n-- != 0 && *d != '\0')
130 +                d++;
131 +        dlen = d - dst;
132 +        n = siz - dlen;
133 +
134 +        if (n == 0)
135 +                return(dlen + strlen(s));
136 +        while (*s != '\0') {
137 +                if (n != 1) {
138 +                        *d++ = *s;
139 +                        n--;
140 +                }
141 +                s++;
142 +        }
143 +        *d = '\0';
144 +
145 +        return(dlen + (s - src));       /* count does not include NUL */
146 + }
147 +
148 + #endif
149 + /* End strlcat function taken from OpenSSH */
150 +
151   void log_msg(int level, char *format, ...){
79        extern int errno;
152          int cur_errno;
153          va_list ap;
154  
# Line 221 | Line 293 | int ihost_getconfig(ihost_state_t *ihost_state){
293          time_t config_ttl=0;
294  
295          if((tcp_con=create_tcp_connection(ihost_state->filtermanager_host, ihost_state->filtermanager_port))==NULL){
296 <                goto error;
296 >                return -1;
297          }
298  
299          if(ihost_state->file_list!=NULL || ihost_state->last_modified!=NULL){
# Line 238 | Line 310 | int ihost_getconfig(ihost_state_t *ihost_state){
310                  }
311          
312                  if((tcp_comm(tcp_con, ihost_state->last_modified, &response, "OK"))==0){
313 <                        if((tcp_comm(tcp_con, "END", &response, "OK"))==0){
313 >                        if((tcp_comm(tcp_con, "END", &response, "OK"))!=0){
314                                  goto error;
315                          }
316                          fclose(tcp_con);
# Line 517 | Line 589 | int get_system_stats(int seq_no, ihost_state_t *ihost_
589          /* get diskio stats */
590          
591          if((diskio_stats=get_diskio_stats_diff(&diskio_entries))==NULL){
592 <                log_msg(LOG_CRIT, "Fahttp://www.cs.ukc.ac.uk/teaching/02/modules/CO/6/17/rdl/criteria.pdfiled to get diskio statistics");
592 >                log_msg(LOG_CRIT, "Failed to get diskio statistics");
593          }else{
594                  strlcat(xml, "<diskio>", size);
595                  for(counter=0;counter<diskio_entries;counter++){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines