diff -uNrp watchdog-5.3.1.orig/src/iface.c watchdog-5.3.1/src/iface.c --- watchdog-5.3.1.orig/src/iface.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/iface.c 2007-05-30 13:00:26.000000000 -0400 @@ -66,7 +66,7 @@ int check_iface(struct list *dev) #if USE_SYSLOG /* do verbose logging */ if (verbose && logtick && ticker == 1) - syslog(LOG_INFO, "device %s received %u bytes", dev->name, bytes); + syslog(LOG_INFO, "device %s received %lu bytes", dev->name, bytes); #endif if (dev->parameter.iface.bytes == bytes) { diff -uNrp watchdog-5.3.1.orig/src/keep_alive.c watchdog-5.3.1/src/keep_alive.c --- watchdog-5.3.1.orig/src/keep_alive.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/keep_alive.c 2007-05-30 13:00:26.000000000 -0400 @@ -20,7 +20,6 @@ int write_heartbeat(void) struct tm *tm; char tbuf[TS_SIZE + 1]; char tbufw[TS_SIZE + 1]; - int i; if (hb == NULL) return (ENOERR); diff -uNrp watchdog-5.3.1.orig/src/lomount.c watchdog-5.3.1/src/lomount.c --- watchdog-5.3.1.orig/src/lomount.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/lomount.c 2007-05-30 13:00:26.000000000 -0400 @@ -195,13 +195,13 @@ set_loop (const char *device, const char break; case LO_CRYPT_XOR: pass = getpass ("Password: "); - strncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE); + strncpy ((char *)loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE); loopinfo.lo_encrypt_key[LO_KEY_SIZE - 1] = 0; - loopinfo.lo_encrypt_key_size = strlen (loopinfo.lo_encrypt_key); + loopinfo.lo_encrypt_key_size = (int) strlen ((char *)loopinfo.lo_encrypt_key); break; case LO_CRYPT_DES: pass = getpass ("Password: "); - strncpy (loopinfo.lo_encrypt_key, pass, 8); + strncpy ((char *)loopinfo.lo_encrypt_key, pass, 8); loopinfo.lo_encrypt_key[8] = 0; loopinfo.lo_encrypt_key_size = 8; pass = getpass ("Init (up to 16 hex digits): "); diff -uNrp watchdog-5.3.1.orig/src/mntent.c watchdog-5.3.1/src/mntent.c --- watchdog-5.3.1.orig/src/mntent.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/mntent.c 2007-05-30 13:00:26.000000000 -0400 @@ -21,9 +21,9 @@ static char need_escaping[] = { ' ', '\t', '\n', '\\' }; static char * -mangle(unsigned char *s) { +mangle(const char *s) { char *ss, *sp; - int n; + size_t n; n = strlen(s); ss = sp = xmalloc(4*n+1); diff -uNrp watchdog-5.3.1.orig/src/net.c watchdog-5.3.1/src/net.c --- watchdog-5.3.1.orig/src/net.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/net.c 2007-05-30 13:00:26.000000000 -0400 @@ -57,7 +57,9 @@ int check_net(char *target, int sock_fp, for (i = 0; i < count; i++) { struct sockaddr_in from; - int fromlen, fdmask, j; + int fdmask, j; + int *fdmask_p; + socklen_t fromlen; struct timeval timeout, dtimeout; struct icmphdr *icp = (struct icmphdr *) outpack; @@ -119,11 +121,11 @@ int check_net(char *target, int sock_fp, break; #if USE_SYSLOG if (verbose && logtick && ticker == 1) - syslog(LOG_ERR, "ping select timeout = %d seconds and %d useconds\n", dtimeout.tv_sec, dtimeout.tv_usec); + syslog(LOG_ERR, "ping select timeout = %ld seconds and %ld useconds\n", dtimeout.tv_sec, dtimeout.tv_usec); #endif /* USE_SYSLOG */ + fdmask_p = &fdmask; - if (select(sock_fp + 1, (fd_set *) & fdmask, (fd_set *) NULL, - (fd_set *) NULL, &dtimeout) >= 1) { + if (select(sock_fp + 1, (fd_set *) fdmask_p, (fd_set *) NULL, (fd_set *) NULL, &dtimeout) >= 1) { /* read reply */ fromlen = sizeof(from); diff -uNrp watchdog-5.3.1.orig/src/nfsmount.c watchdog-5.3.1/src/nfsmount.c --- watchdog-5.3.1.orig/src/nfsmount.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/nfsmount.c 2007-05-30 13:00:26.000000000 -0400 @@ -55,6 +55,7 @@ #include #include "mount_constants.h" #include "nfs_mount4.h" +#include #define HAVE_inet_aton diff -uNrp watchdog-5.3.1.orig/src/nfsmount_xdr.c watchdog-5.3.1/src/nfsmount_xdr.c --- watchdog-5.3.1.orig/src/nfsmount_xdr.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/nfsmount_xdr.c 2007-05-30 13:00:37.000000000 -0400 @@ -43,8 +43,6 @@ bool_t xdr_fhandle (XDR *xdrs, fhandle objp) { - register int32_t *buf; - if (!xdr_opaque (xdrs, objp, FHSIZE)) return FALSE; return TRUE; @@ -53,8 +51,6 @@ xdr_fhandle (XDR *xdrs, fhandle objp) bool_t xdr_fhandle3 (XDR *xdrs, fhandle3 *objp) { - register int32_t *buf; - if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3)) return FALSE; return TRUE; @@ -63,8 +59,6 @@ xdr_fhandle3 (XDR *xdrs, fhandle3 *objp) bool_t xdr_mountstat3 (XDR *xdrs, mountstat3 *objp) { - register int32_t *buf; - if (!xdr_enum (xdrs, (enum_t *) objp)) return FALSE; return TRUE; @@ -73,8 +67,6 @@ xdr_mountstat3 (XDR *xdrs, mountstat3 *o bool_t xdr_fhstatus (XDR *xdrs, fhstatus *objp) { - register int32_t *buf; - if (!xdr_u_int (xdrs, &objp->fhs_status)) return FALSE; switch (objp->fhs_status) { @@ -91,8 +83,6 @@ xdr_fhstatus (XDR *xdrs, fhstatus *objp) bool_t xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp) { - register int32_t *buf; - if (!xdr_fhandle3 (xdrs, &objp->fhandle)) return FALSE; if (!xdr_array (xdrs, (char **)&objp->auth_flavours.auth_flavours_val, (u_int *) &objp->auth_flavours.auth_flavours_len, ~0, @@ -104,8 +94,6 @@ xdr_mountres3_ok (XDR *xdrs, mountres3_o bool_t xdr_mountres3 (XDR *xdrs, mountres3 *objp) { - register int32_t *buf; - if (!xdr_mountstat3 (xdrs, &objp->fhs_status)) return FALSE; switch (objp->fhs_status) { @@ -122,8 +110,6 @@ xdr_mountres3 (XDR *xdrs, mountres3 *obj bool_t xdr_dirpath (XDR *xdrs, dirpath *objp) { - register int32_t *buf; - if (!xdr_string (xdrs, objp, MNTPATHLEN)) return FALSE; return TRUE; @@ -132,8 +118,6 @@ xdr_dirpath (XDR *xdrs, dirpath *objp) bool_t xdr_name (XDR *xdrs, name *objp) { - register int32_t *buf; - if (!xdr_string (xdrs, objp, MNTNAMLEN)) return FALSE; return TRUE; @@ -142,8 +126,6 @@ xdr_name (XDR *xdrs, name *objp) bool_t xdr_mountlist (XDR *xdrs, mountlist *objp) { - register int32_t *buf; - if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody)) return FALSE; return TRUE; @@ -152,8 +134,6 @@ xdr_mountlist (XDR *xdrs, mountlist *obj bool_t xdr_mountbody (XDR *xdrs, mountbody *objp) { - register int32_t *buf; - if (!xdr_name (xdrs, &objp->ml_hostname)) return FALSE; if (!xdr_dirpath (xdrs, &objp->ml_directory)) @@ -166,8 +146,6 @@ xdr_mountbody (XDR *xdrs, mountbody *obj bool_t xdr_groups (XDR *xdrs, groups *objp) { - register int32_t *buf; - if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode)) return FALSE; return TRUE; @@ -176,8 +154,6 @@ xdr_groups (XDR *xdrs, groups *objp) bool_t xdr_groupnode (XDR *xdrs, groupnode *objp) { - register int32_t *buf; - if (!xdr_name (xdrs, &objp->gr_name)) return FALSE; if (!xdr_groups (xdrs, &objp->gr_next)) @@ -188,8 +164,6 @@ xdr_groupnode (XDR *xdrs, groupnode *obj bool_t xdr_exports (XDR *xdrs, exports *objp) { - register int32_t *buf; - if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode)) return FALSE; return TRUE; @@ -198,8 +172,6 @@ xdr_exports (XDR *xdrs, exports *objp) bool_t xdr_exportnode (XDR *xdrs, exportnode *objp) { - register int32_t *buf; - if (!xdr_dirpath (xdrs, &objp->ex_dir)) return FALSE; if (!xdr_groups (xdrs, &objp->ex_groups)) @@ -212,8 +184,7 @@ xdr_exportnode (XDR *xdrs, exportnode *o bool_t xdr_ppathcnf (XDR *xdrs, ppathcnf *objp) { - register int32_t *buf; - + register int32_t *buf; int i; if (xdrs->x_op == XDR_ENCODE) { diff -uNrp watchdog-5.3.1.orig/src/pidfile.c watchdog-5.3.1/src/pidfile.c --- watchdog-5.3.1.orig/src/pidfile.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/pidfile.c 2007-05-30 13:00:26.000000000 -0400 @@ -8,7 +8,9 @@ #include #include "extern.h" #include "watch_err.h" - +#include +#include +#include #if USE_SYSLOG #include #endif diff -uNrp watchdog-5.3.1.orig/src/shutdown.c watchdog-5.3.1/src/shutdown.c --- watchdog-5.3.1.orig/src/shutdown.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/shutdown.c 2007-05-30 13:00:26.000000000 -0400 @@ -22,6 +22,10 @@ #include "watch_err.h" #include "extern.h" +#include +#include +#include + #if defined __GLIBC__ #include "ext2_mnt.h" #include @@ -66,7 +70,7 @@ static void log_end() { #if USE_SYSLOG /* Log the closing message */ - syslog(LOG_INFO, "stopping daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION); + syslog(LOG_INFO, "stopping daemon (%d.%.1f)", MAJOR_VERSION, MINOR_VERSION); closelog(); sleep(5); /* make sure log is written */ @@ -319,6 +323,7 @@ static void killall5(int sig) void do_shutdown(int errorcode) { int i = 0, fd; + size_t write_len; char *seedbck = RANDOM_SEED; /* soft-boot the system */ @@ -426,7 +431,7 @@ void do_shutdown(int errorcode) wtmp.ut_pid = 0; wtmp.ut_type = RUN_LVL; wtmp.ut_time = t; - write(fd, (char *) &wtmp, sizeof(wtmp)); + write_len = write(fd, (char *) &wtmp, sizeof(wtmp)); close(fd); } @@ -441,8 +446,9 @@ void do_shutdown(int errorcode) if ((fd_bck = creat(seedbck, S_IRUSR | S_IWUSR)) >= 0) { char buf[512]; - if (read(fd_seed, buf, 512) == 512) - write(fd_bck, buf, 512); + if (read(fd_seed, buf, 512) == 512) { + write_len= write(fd_bck, buf, 512); + } close(fd_bck); } close(fd_seed); diff -uNrp watchdog-5.3.1.orig/src/temp.c watchdog-5.3.1/src/temp.c --- watchdog-5.3.1.orig/src/temp.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/temp.c 2007-05-30 13:00:26.000000000 -0400 @@ -31,7 +31,7 @@ int check_temp(void) int err = errno; #if USE_SYSLOG - syslog(LOG_ERR, "read %s gave errno = %d = '%m'", err, tempname); + syslog(LOG_ERR, "read %s gave errno = %d = '%m'", tempname, err); #else /* USE_SYSLOG */ perror(progname); #endif /* USE_SYSLOG */ diff -uNrp watchdog-5.3.1.orig/src/test_binary.c watchdog-5.3.1/src/test_binary.c --- watchdog-5.3.1.orig/src/test_binary.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/test_binary.c 2007-05-30 13:00:26.000000000 -0400 @@ -10,6 +10,7 @@ #include #include "extern.h" #include "watch_err.h" +#include #if USE_SYSLOG #include @@ -76,7 +77,7 @@ int check_bin(char *tbinary, time_t time res = check_processes(timeout); if (res == ETOOLONG) { #if USE_SYSLOG - syslog(LOG_ERR, "test-binary %s exceeded time limit %d", tbinary, timeout); + syslog(LOG_ERR, "test-binary %s exceeded time limit %ld", tbinary, timeout); #endif /* USE_SYSLOG */ return res; } diff -uNrp watchdog-5.3.1.orig/src/watchdog.c watchdog-5.3.1/src/watchdog.c --- watchdog-5.3.1.orig/src/watchdog.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/watchdog.c 2007-05-30 13:00:26.000000000 -0400 @@ -23,6 +23,10 @@ #include #include #include +#include +#include + + #define __USE_GNU #include @@ -72,7 +76,7 @@ pid_t pid; int softboot = FALSE, watchdog = -1, load = -1, mem = -1, temp = -1; int tint = 10, logtick = 1, ticker = 1, schedprio = 1; int maxload1 = 0, maxload5 = 0, maxload15 = 0, minpages = 0; -int maxtemp = 120, hbstamps = 300, lastts, nrts; +int maxtemp = 120, hbstamps = 300, lastts=0, nrts; int pingcount = 3; char *tempname = NULL, *devname = NULL, *admin = "root", *progname; char *timestamps, *heartbeat; @@ -85,7 +89,7 @@ int mlocked = FALSE, realtime = FALSE; static void usage(void) { - fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); + fprintf(stderr, "%s version %d.%.1f, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); #if USE_SYSLOG fprintf(stderr, "%s [-i [-f]] [-l ] [-v] [-s] [-b] [-m ]\n", progname); #else /* USE_SYSLOG */ @@ -615,8 +619,8 @@ int main(int argc, char *const argv[]) /* Log the starting message */ openlog(progname, LOG_PID, LOG_DAEMON); - syslog(LOG_INFO, "starting daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION); - syslog(LOG_INFO, "int=%ds realtime=%s sync=%s soft=%s mla=%d mem=%ld", + syslog(LOG_INFO, "starting daemon (%d.%.1f):", MAJOR_VERSION, MINOR_VERSION); + syslog(LOG_INFO, "int=%ds realtime=%s sync=%s soft=%s mla=%d mem=%d", tint, realtime ? "yes" : "no", sync_it ? "yes" : "no", @@ -647,7 +651,7 @@ int main(int argc, char *const argv[]) for (act = iface; act != NULL; act = act->next) syslog(LOG_INFO, "interface: %s", act->name); - syslog(LOG_INFO, "test=%s(%d) repair=%s alive=%s heartbeat=%s temp=%s to=%s no_act=%s", + syslog(LOG_INFO, "test=%s(%ld) repair=%s alive=%s heartbeat=%s temp=%s to=%s no_act=%s", (tbinary == NULL) ? "none" : tbinary, timeout, (rbinary == NULL) ? "none" : rbinary, (devname == NULL) ? "none" : devname, @@ -689,7 +693,7 @@ int main(int argc, char *const argv[]) /* Allocate memory for keeping the timestamps in */ nrts = 0; lastts = 0; - timestamps = (unsigned char *) calloc(hbstamps, TS_SIZE); + timestamps = (char *) calloc(hbstamps, TS_SIZE); if ( timestamps == NULL ) { #if USE_SYSLOG syslog(LOG_ERR, "cannot allocate memory for timestamps (errno = %d = '%m')", errno); diff -uNrp watchdog-5.3.1.orig/src/wd_keepalive.c watchdog-5.3.1/src/wd_keepalive.c --- watchdog-5.3.1.orig/src/wd_keepalive.c 2007-05-29 14:59:18.000000000 -0400 +++ watchdog-5.3.1/src/wd_keepalive.c 2007-05-30 13:00:26.000000000 -0400 @@ -22,6 +22,7 @@ #include #include #include + #define __USE_GNU #include #include @@ -46,22 +47,22 @@ char *devname = NULL, *progname = NULL; #if defined(_POSIX_MEMLOCK) int mlocked = FALSE, realtime = FALSE; #endif - +/* static void usage(void) { - fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); + fprintf(stderr, "%s version %d.%.1f, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION); fprintf(stderr, "%s \n", progname); exit(1); } - +*/ /* write a log entry on exit */ static void log_end() { #if USE_SYSLOG /* Log the closing message */ - syslog(LOG_INFO, "stopping keepalive daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION); + syslog(LOG_INFO, "stopping keepalive daemon (%d.%.1f)", MAJOR_VERSION, MINOR_VERSION); closelog(); sleep(5); /* make sure log is written */ #endif /* USE_SYSLOG */ @@ -251,7 +252,7 @@ int main(int argc, char *const argv[]) /* Log the starting message */ openlog(progname, LOG_PID, LOG_DAEMON); - sprintf(log, "starting watchdog keepalive daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION); + sprintf(log, "starting watchdog keepalive daemon (%d.%.1f):", MAJOR_VERSION, MINOR_VERSION); sprintf(log + strlen(log), " int=%d alive=%s realtime=%s", tint, devname, realtime ? "yes" : "no"); syslog(LOG_INFO, log); #endif /* USE_SYSLOG */