/[smecontribs]/rpms/watchdog/contribs7/watchdog-5.3.1-cleanup.patch
ViewVC logotype

Annotation of /rpms/watchdog/contribs7/watchdog-5.3.1-cleanup.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Sat Dec 4 16:42:57 2010 UTC (13 years, 5 months ago) by slords
Branch: MAIN
CVS Tags: watchdog-5_3_1-7_el4_sme, HEAD
Initial import

1 slords 1.1 diff -uNrp watchdog-5.3.1.orig/src/iface.c watchdog-5.3.1/src/iface.c
2     --- watchdog-5.3.1.orig/src/iface.c 2007-05-29 14:59:18.000000000 -0400
3     +++ watchdog-5.3.1/src/iface.c 2007-05-30 13:00:26.000000000 -0400
4     @@ -66,7 +66,7 @@ int check_iface(struct list *dev)
5     #if USE_SYSLOG
6     /* do verbose logging */
7     if (verbose && logtick && ticker == 1)
8     - syslog(LOG_INFO, "device %s received %u bytes", dev->name, bytes);
9     + syslog(LOG_INFO, "device %s received %lu bytes", dev->name, bytes);
10     #endif
11    
12     if (dev->parameter.iface.bytes == bytes) {
13     diff -uNrp watchdog-5.3.1.orig/src/keep_alive.c watchdog-5.3.1/src/keep_alive.c
14     --- watchdog-5.3.1.orig/src/keep_alive.c 2007-05-29 14:59:18.000000000 -0400
15     +++ watchdog-5.3.1/src/keep_alive.c 2007-05-30 13:00:26.000000000 -0400
16     @@ -20,7 +20,6 @@ int write_heartbeat(void)
17     struct tm *tm;
18     char tbuf[TS_SIZE + 1];
19     char tbufw[TS_SIZE + 1];
20     - int i;
21    
22     if (hb == NULL)
23     return (ENOERR);
24     diff -uNrp watchdog-5.3.1.orig/src/lomount.c watchdog-5.3.1/src/lomount.c
25     --- watchdog-5.3.1.orig/src/lomount.c 2007-05-29 14:59:18.000000000 -0400
26     +++ watchdog-5.3.1/src/lomount.c 2007-05-30 13:00:26.000000000 -0400
27     @@ -195,13 +195,13 @@ set_loop (const char *device, const char
28     break;
29     case LO_CRYPT_XOR:
30     pass = getpass ("Password: ");
31     - strncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
32     + strncpy ((char *)loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
33     loopinfo.lo_encrypt_key[LO_KEY_SIZE - 1] = 0;
34     - loopinfo.lo_encrypt_key_size = strlen (loopinfo.lo_encrypt_key);
35     + loopinfo.lo_encrypt_key_size = (int) strlen ((char *)loopinfo.lo_encrypt_key);
36     break;
37     case LO_CRYPT_DES:
38     pass = getpass ("Password: ");
39     - strncpy (loopinfo.lo_encrypt_key, pass, 8);
40     + strncpy ((char *)loopinfo.lo_encrypt_key, pass, 8);
41     loopinfo.lo_encrypt_key[8] = 0;
42     loopinfo.lo_encrypt_key_size = 8;
43     pass = getpass ("Init (up to 16 hex digits): ");
44     diff -uNrp watchdog-5.3.1.orig/src/mntent.c watchdog-5.3.1/src/mntent.c
45     --- watchdog-5.3.1.orig/src/mntent.c 2007-05-29 14:59:18.000000000 -0400
46     +++ watchdog-5.3.1/src/mntent.c 2007-05-30 13:00:26.000000000 -0400
47     @@ -21,9 +21,9 @@
48     static char need_escaping[] = { ' ', '\t', '\n', '\\' };
49    
50     static char *
51     -mangle(unsigned char *s) {
52     +mangle(const char *s) {
53     char *ss, *sp;
54     - int n;
55     + size_t n;
56    
57     n = strlen(s);
58     ss = sp = xmalloc(4*n+1);
59     diff -uNrp watchdog-5.3.1.orig/src/net.c watchdog-5.3.1/src/net.c
60     --- watchdog-5.3.1.orig/src/net.c 2007-05-29 14:59:18.000000000 -0400
61     +++ watchdog-5.3.1/src/net.c 2007-05-30 13:00:26.000000000 -0400
62     @@ -57,7 +57,9 @@ int check_net(char *target, int sock_fp,
63     for (i = 0; i < count; i++) {
64    
65     struct sockaddr_in from;
66     - int fromlen, fdmask, j;
67     + int fdmask, j;
68     + int *fdmask_p;
69     + socklen_t fromlen;
70     struct timeval timeout, dtimeout;
71     struct icmphdr *icp = (struct icmphdr *) outpack;
72    
73     @@ -119,11 +121,11 @@ int check_net(char *target, int sock_fp,
74     break;
75     #if USE_SYSLOG
76     if (verbose && logtick && ticker == 1)
77     - syslog(LOG_ERR, "ping select timeout = %d seconds and %d useconds\n", dtimeout.tv_sec, dtimeout.tv_usec);
78     + syslog(LOG_ERR, "ping select timeout = %ld seconds and %ld useconds\n", dtimeout.tv_sec, dtimeout.tv_usec);
79     #endif /* USE_SYSLOG */
80     + fdmask_p = &fdmask;
81    
82     - if (select(sock_fp + 1, (fd_set *) & fdmask, (fd_set *) NULL,
83     - (fd_set *) NULL, &dtimeout) >= 1) {
84     + if (select(sock_fp + 1, (fd_set *) fdmask_p, (fd_set *) NULL, (fd_set *) NULL, &dtimeout) >= 1) {
85    
86     /* read reply */
87     fromlen = sizeof(from);
88     diff -uNrp watchdog-5.3.1.orig/src/nfsmount.c watchdog-5.3.1/src/nfsmount.c
89     --- watchdog-5.3.1.orig/src/nfsmount.c 2007-05-29 14:59:18.000000000 -0400
90     +++ watchdog-5.3.1/src/nfsmount.c 2007-05-30 13:00:26.000000000 -0400
91     @@ -55,6 +55,7 @@
92     #include <linux/nfs.h>
93     #include "mount_constants.h"
94     #include "nfs_mount4.h"
95     +#include <time.h>
96    
97     #define HAVE_inet_aton
98    
99     diff -uNrp watchdog-5.3.1.orig/src/nfsmount_xdr.c watchdog-5.3.1/src/nfsmount_xdr.c
100     --- watchdog-5.3.1.orig/src/nfsmount_xdr.c 2007-05-29 14:59:18.000000000 -0400
101     +++ watchdog-5.3.1/src/nfsmount_xdr.c 2007-05-30 13:00:37.000000000 -0400
102     @@ -43,8 +43,6 @@
103     bool_t
104     xdr_fhandle (XDR *xdrs, fhandle objp)
105     {
106     - register int32_t *buf;
107     -
108     if (!xdr_opaque (xdrs, objp, FHSIZE))
109     return FALSE;
110     return TRUE;
111     @@ -53,8 +51,6 @@ xdr_fhandle (XDR *xdrs, fhandle objp)
112     bool_t
113     xdr_fhandle3 (XDR *xdrs, fhandle3 *objp)
114     {
115     - register int32_t *buf;
116     -
117     if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3))
118     return FALSE;
119     return TRUE;
120     @@ -63,8 +59,6 @@ xdr_fhandle3 (XDR *xdrs, fhandle3 *objp)
121     bool_t
122     xdr_mountstat3 (XDR *xdrs, mountstat3 *objp)
123     {
124     - register int32_t *buf;
125     -
126     if (!xdr_enum (xdrs, (enum_t *) objp))
127     return FALSE;
128     return TRUE;
129     @@ -73,8 +67,6 @@ xdr_mountstat3 (XDR *xdrs, mountstat3 *o
130     bool_t
131     xdr_fhstatus (XDR *xdrs, fhstatus *objp)
132     {
133     - register int32_t *buf;
134     -
135     if (!xdr_u_int (xdrs, &objp->fhs_status))
136     return FALSE;
137     switch (objp->fhs_status) {
138     @@ -91,8 +83,6 @@ xdr_fhstatus (XDR *xdrs, fhstatus *objp)
139     bool_t
140     xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp)
141     {
142     - register int32_t *buf;
143     -
144     if (!xdr_fhandle3 (xdrs, &objp->fhandle))
145     return FALSE;
146     if (!xdr_array (xdrs, (char **)&objp->auth_flavours.auth_flavours_val, (u_int *) &objp->auth_flavours.auth_flavours_len, ~0,
147     @@ -104,8 +94,6 @@ xdr_mountres3_ok (XDR *xdrs, mountres3_o
148     bool_t
149     xdr_mountres3 (XDR *xdrs, mountres3 *objp)
150     {
151     - register int32_t *buf;
152     -
153     if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
154     return FALSE;
155     switch (objp->fhs_status) {
156     @@ -122,8 +110,6 @@ xdr_mountres3 (XDR *xdrs, mountres3 *obj
157     bool_t
158     xdr_dirpath (XDR *xdrs, dirpath *objp)
159     {
160     - register int32_t *buf;
161     -
162     if (!xdr_string (xdrs, objp, MNTPATHLEN))
163     return FALSE;
164     return TRUE;
165     @@ -132,8 +118,6 @@ xdr_dirpath (XDR *xdrs, dirpath *objp)
166     bool_t
167     xdr_name (XDR *xdrs, name *objp)
168     {
169     - register int32_t *buf;
170     -
171     if (!xdr_string (xdrs, objp, MNTNAMLEN))
172     return FALSE;
173     return TRUE;
174     @@ -142,8 +126,6 @@ xdr_name (XDR *xdrs, name *objp)
175     bool_t
176     xdr_mountlist (XDR *xdrs, mountlist *objp)
177     {
178     - register int32_t *buf;
179     -
180     if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody))
181     return FALSE;
182     return TRUE;
183     @@ -152,8 +134,6 @@ xdr_mountlist (XDR *xdrs, mountlist *obj
184     bool_t
185     xdr_mountbody (XDR *xdrs, mountbody *objp)
186     {
187     - register int32_t *buf;
188     -
189     if (!xdr_name (xdrs, &objp->ml_hostname))
190     return FALSE;
191     if (!xdr_dirpath (xdrs, &objp->ml_directory))
192     @@ -166,8 +146,6 @@ xdr_mountbody (XDR *xdrs, mountbody *obj
193     bool_t
194     xdr_groups (XDR *xdrs, groups *objp)
195     {
196     - register int32_t *buf;
197     -
198     if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode))
199     return FALSE;
200     return TRUE;
201     @@ -176,8 +154,6 @@ xdr_groups (XDR *xdrs, groups *objp)
202     bool_t
203     xdr_groupnode (XDR *xdrs, groupnode *objp)
204     {
205     - register int32_t *buf;
206     -
207     if (!xdr_name (xdrs, &objp->gr_name))
208     return FALSE;
209     if (!xdr_groups (xdrs, &objp->gr_next))
210     @@ -188,8 +164,6 @@ xdr_groupnode (XDR *xdrs, groupnode *obj
211     bool_t
212     xdr_exports (XDR *xdrs, exports *objp)
213     {
214     - register int32_t *buf;
215     -
216     if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode))
217     return FALSE;
218     return TRUE;
219     @@ -198,8 +172,6 @@ xdr_exports (XDR *xdrs, exports *objp)
220     bool_t
221     xdr_exportnode (XDR *xdrs, exportnode *objp)
222     {
223     - register int32_t *buf;
224     -
225     if (!xdr_dirpath (xdrs, &objp->ex_dir))
226     return FALSE;
227     if (!xdr_groups (xdrs, &objp->ex_groups))
228     @@ -212,8 +184,7 @@ xdr_exportnode (XDR *xdrs, exportnode *o
229     bool_t
230     xdr_ppathcnf (XDR *xdrs, ppathcnf *objp)
231     {
232     - register int32_t *buf;
233     -
234     + register int32_t *buf;
235     int i;
236    
237     if (xdrs->x_op == XDR_ENCODE) {
238     diff -uNrp watchdog-5.3.1.orig/src/pidfile.c watchdog-5.3.1/src/pidfile.c
239     --- watchdog-5.3.1.orig/src/pidfile.c 2007-05-29 14:59:18.000000000 -0400
240     +++ watchdog-5.3.1/src/pidfile.c 2007-05-30 13:00:26.000000000 -0400
241     @@ -8,7 +8,9 @@
242     #include <fcntl.h>
243     #include "extern.h"
244     #include "watch_err.h"
245     -
246     +#include <unistd.h>
247     +#include <stdlib.h>
248     +#include <wait.h>
249     #if USE_SYSLOG
250     #include <syslog.h>
251     #endif
252     diff -uNrp watchdog-5.3.1.orig/src/shutdown.c watchdog-5.3.1/src/shutdown.c
253     --- watchdog-5.3.1.orig/src/shutdown.c 2007-05-29 14:59:18.000000000 -0400
254     +++ watchdog-5.3.1/src/shutdown.c 2007-05-30 13:00:26.000000000 -0400
255     @@ -22,6 +22,10 @@
256     #include "watch_err.h"
257     #include "extern.h"
258    
259     +#include <sys/types.h>
260     +#include <unistd.h>
261     +#include <time.h>
262     +
263     #if defined __GLIBC__
264     #include "ext2_mnt.h"
265     #include <sys/quota.h>
266     @@ -66,7 +70,7 @@ static void log_end()
267     {
268     #if USE_SYSLOG
269     /* Log the closing message */
270     - syslog(LOG_INFO, "stopping daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION);
271     + syslog(LOG_INFO, "stopping daemon (%d.%.1f)", MAJOR_VERSION, MINOR_VERSION);
272     closelog();
273    
274     sleep(5); /* make sure log is written */
275     @@ -319,6 +323,7 @@ static void killall5(int sig)
276     void do_shutdown(int errorcode)
277     {
278     int i = 0, fd;
279     + size_t write_len;
280     char *seedbck = RANDOM_SEED;
281    
282     /* soft-boot the system */
283     @@ -426,7 +431,7 @@ void do_shutdown(int errorcode)
284     wtmp.ut_pid = 0;
285     wtmp.ut_type = RUN_LVL;
286     wtmp.ut_time = t;
287     - write(fd, (char *) &wtmp, sizeof(wtmp));
288     + write_len = write(fd, (char *) &wtmp, sizeof(wtmp));
289     close(fd);
290     }
291    
292     @@ -441,8 +446,9 @@ void do_shutdown(int errorcode)
293     if ((fd_bck = creat(seedbck, S_IRUSR | S_IWUSR)) >= 0) {
294     char buf[512];
295    
296     - if (read(fd_seed, buf, 512) == 512)
297     - write(fd_bck, buf, 512);
298     + if (read(fd_seed, buf, 512) == 512) {
299     + write_len= write(fd_bck, buf, 512);
300     + }
301     close(fd_bck);
302     }
303     close(fd_seed);
304     diff -uNrp watchdog-5.3.1.orig/src/temp.c watchdog-5.3.1/src/temp.c
305     --- watchdog-5.3.1.orig/src/temp.c 2007-05-29 14:59:18.000000000 -0400
306     +++ watchdog-5.3.1/src/temp.c 2007-05-30 13:00:26.000000000 -0400
307     @@ -31,7 +31,7 @@ int check_temp(void)
308     int err = errno;
309    
310     #if USE_SYSLOG
311     - syslog(LOG_ERR, "read %s gave errno = %d = '%m'", err, tempname);
312     + syslog(LOG_ERR, "read %s gave errno = %d = '%m'", tempname, err);
313     #else /* USE_SYSLOG */
314     perror(progname);
315     #endif /* USE_SYSLOG */
316     diff -uNrp watchdog-5.3.1.orig/src/test_binary.c watchdog-5.3.1/src/test_binary.c
317     --- watchdog-5.3.1.orig/src/test_binary.c 2007-05-29 14:59:18.000000000 -0400
318     +++ watchdog-5.3.1/src/test_binary.c 2007-05-30 13:00:26.000000000 -0400
319     @@ -10,6 +10,7 @@
320     #include <sys/wait.h>
321     #include "extern.h"
322     #include "watch_err.h"
323     +#include <time.h>
324    
325     #if USE_SYSLOG
326     #include <syslog.h>
327     @@ -76,7 +77,7 @@ int check_bin(char *tbinary, time_t time
328     res = check_processes(timeout);
329     if (res == ETOOLONG) {
330     #if USE_SYSLOG
331     - syslog(LOG_ERR, "test-binary %s exceeded time limit %d", tbinary, timeout);
332     + syslog(LOG_ERR, "test-binary %s exceeded time limit %ld", tbinary, timeout);
333     #endif /* USE_SYSLOG */
334     return res;
335     }
336     diff -uNrp watchdog-5.3.1.orig/src/watchdog.c watchdog-5.3.1/src/watchdog.c
337     --- watchdog-5.3.1.orig/src/watchdog.c 2007-05-29 14:59:18.000000000 -0400
338     +++ watchdog-5.3.1/src/watchdog.c 2007-05-30 13:00:26.000000000 -0400
339     @@ -23,6 +23,10 @@
340     #include <arpa/inet.h>
341     #include <sys/mman.h>
342     #include <sys/wait.h>
343     +#include <sys/stat.h>
344     +#include <sys/types.h>
345     +
346     +
347     #define __USE_GNU
348     #include <string.h>
349    
350     @@ -72,7 +76,7 @@ pid_t pid;
351     int softboot = FALSE, watchdog = -1, load = -1, mem = -1, temp = -1;
352     int tint = 10, logtick = 1, ticker = 1, schedprio = 1;
353     int maxload1 = 0, maxload5 = 0, maxload15 = 0, minpages = 0;
354     -int maxtemp = 120, hbstamps = 300, lastts, nrts;
355     +int maxtemp = 120, hbstamps = 300, lastts=0, nrts;
356     int pingcount = 3;
357     char *tempname = NULL, *devname = NULL, *admin = "root", *progname;
358     char *timestamps, *heartbeat;
359     @@ -85,7 +89,7 @@ int mlocked = FALSE, realtime = FALSE;
360    
361     static void usage(void)
362     {
363     - fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION);
364     + fprintf(stderr, "%s version %d.%.1f, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION);
365     #if USE_SYSLOG
366     fprintf(stderr, "%s [-i <interval> [-f]] [-l <max load avg>] [-v] [-s] [-b] [-m <max temperature>]\n", progname);
367     #else /* USE_SYSLOG */
368     @@ -615,8 +619,8 @@ int main(int argc, char *const argv[])
369    
370     /* Log the starting message */
371     openlog(progname, LOG_PID, LOG_DAEMON);
372     - syslog(LOG_INFO, "starting daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION);
373     - syslog(LOG_INFO, "int=%ds realtime=%s sync=%s soft=%s mla=%d mem=%ld",
374     + syslog(LOG_INFO, "starting daemon (%d.%.1f):", MAJOR_VERSION, MINOR_VERSION);
375     + syslog(LOG_INFO, "int=%ds realtime=%s sync=%s soft=%s mla=%d mem=%d",
376     tint,
377     realtime ? "yes" : "no",
378     sync_it ? "yes" : "no",
379     @@ -647,7 +651,7 @@ int main(int argc, char *const argv[])
380     for (act = iface; act != NULL; act = act->next)
381     syslog(LOG_INFO, "interface: %s", act->name);
382    
383     - syslog(LOG_INFO, "test=%s(%d) repair=%s alive=%s heartbeat=%s temp=%s to=%s no_act=%s",
384     + syslog(LOG_INFO, "test=%s(%ld) repair=%s alive=%s heartbeat=%s temp=%s to=%s no_act=%s",
385     (tbinary == NULL) ? "none" : tbinary, timeout,
386     (rbinary == NULL) ? "none" : rbinary,
387     (devname == NULL) ? "none" : devname,
388     @@ -689,7 +693,7 @@ int main(int argc, char *const argv[])
389     /* Allocate memory for keeping the timestamps in */
390     nrts = 0;
391     lastts = 0;
392     - timestamps = (unsigned char *) calloc(hbstamps, TS_SIZE);
393     + timestamps = (char *) calloc(hbstamps, TS_SIZE);
394     if ( timestamps == NULL ) {
395     #if USE_SYSLOG
396     syslog(LOG_ERR, "cannot allocate memory for timestamps (errno = %d = '%m')", errno);
397     diff -uNrp watchdog-5.3.1.orig/src/wd_keepalive.c watchdog-5.3.1/src/wd_keepalive.c
398     --- watchdog-5.3.1.orig/src/wd_keepalive.c 2007-05-29 14:59:18.000000000 -0400
399     +++ watchdog-5.3.1/src/wd_keepalive.c 2007-05-30 13:00:26.000000000 -0400
400     @@ -22,6 +22,7 @@
401     #include <stdlib.h>
402     #include <sys/mman.h>
403     #include <sys/wait.h>
404     +
405     #define __USE_GNU
406     #include <string.h>
407     #include <syslog.h>
408     @@ -46,22 +47,22 @@ char *devname = NULL, *progname = NULL;
409     #if defined(_POSIX_MEMLOCK)
410     int mlocked = FALSE, realtime = FALSE;
411     #endif
412     -
413     +/*
414     static void usage(void)
415     {
416     - fprintf(stderr, "%s version %d.%d, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION);
417     + fprintf(stderr, "%s version %d.%.1f, usage:\n", progname, MAJOR_VERSION, MINOR_VERSION);
418     fprintf(stderr, "%s \n", progname);
419     exit(1);
420     }
421    
422     -
423     +*/
424    
425     /* write a log entry on exit */
426     static void log_end()
427     {
428     #if USE_SYSLOG
429     /* Log the closing message */
430     - syslog(LOG_INFO, "stopping keepalive daemon (%d.%d)", MAJOR_VERSION, MINOR_VERSION);
431     + syslog(LOG_INFO, "stopping keepalive daemon (%d.%.1f)", MAJOR_VERSION, MINOR_VERSION);
432     closelog();
433     sleep(5); /* make sure log is written */
434     #endif /* USE_SYSLOG */
435     @@ -251,7 +252,7 @@ int main(int argc, char *const argv[])
436    
437     /* Log the starting message */
438     openlog(progname, LOG_PID, LOG_DAEMON);
439     - sprintf(log, "starting watchdog keepalive daemon (%d.%d):", MAJOR_VERSION, MINOR_VERSION);
440     + sprintf(log, "starting watchdog keepalive daemon (%d.%.1f):", MAJOR_VERSION, MINOR_VERSION);
441     sprintf(log + strlen(log), " int=%d alive=%s realtime=%s", tint, devname, realtime ? "yes" : "no");
442     syslog(LOG_INFO, log);
443     #endif /* USE_SYSLOG */

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed