32 |
|
#include <errno.h> |
33 |
|
#include <netdb.h> |
34 |
|
|
35 |
< |
#include "ukcprog.h" |
36 |
< |
#include "statgrab.h" |
35 |
> |
#include <ukcprog.h> |
36 |
> |
#include <statgrab.h> |
37 |
|
|
38 |
|
#define LOG_CRIT 0 |
39 |
|
#define LOG_ERR 1 |
77 |
|
|
78 |
|
extern int errno; |
79 |
|
|
80 |
< |
/* Taken from the openssh code. Its licence included in function.*/ |
81 |
< |
//#ifndef HAVE_STRLCAT |
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> |
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 |
145 |
|
return(dlen + (s - src)); /* count does not include NUL */ |
146 |
|
} |
147 |
|
|
148 |
< |
//#endif |
148 |
> |
#endif |
149 |
> |
/* End strlcat function taken from OpenSSH */ |
150 |
|
|
149 |
– |
|
151 |
|
void log_msg(int level, char *format, ...){ |
152 |
|
int cur_errno; |
153 |
|
va_list ap; |
163 |
|
}else{ |
164 |
|
fprintf(ihost_config.log, "\n"); |
165 |
|
} |
166 |
+ |
fflush(ihost_config.log); |
167 |
|
} |
168 |
|
} |
169 |
|
|
223 |
|
|
224 |
|
if((get_host_addr(hostname, &haddr))!=0){ |
225 |
|
log_msg(LOG_CRIT, "Failed to lookup name for %s", hostname); |
226 |
+ |
close(sock); |
227 |
|
return NULL; |
228 |
|
} |
229 |
|
|
235 |
|
log_msg(LOG_DEBUG, "Creating a tcp connection"); |
236 |
|
if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) !=0){ |
237 |
|
log_msg(LOG_CRIT, "Failed to connect to hostname %s on port %d", hostname, port); |
238 |
+ |
close(sock); |
239 |
|
return NULL; |
240 |
|
} |
241 |
|
|
296 |
|
time_t config_ttl=0; |
297 |
|
|
298 |
|
if((tcp_con=create_tcp_connection(ihost_state->filtermanager_host, ihost_state->filtermanager_port))==NULL){ |
299 |
< |
goto error; |
299 |
> |
return -1; |
300 |
|
} |
301 |
|
|
302 |
|
if(ihost_state->file_list!=NULL || ihost_state->last_modified!=NULL){ |
581 |
|
y=page_stats->pages_pageout; |
582 |
|
} |
583 |
|
snprintf(tmp, size, \ |
584 |
< |
"<pages><swapins>%lld</swapins><swapouts>%lld</swapouts></pages>", \ |
584 |
> |
"<pages><pageins>%lld</pageins><pageouts>%lld</pageouts></pages>", \ |
585 |
|
x, \ |
586 |
|
y); |
587 |
|
|