diff options
Diffstat (limited to 'web/attachments/121784-nagiosplug-cvs-silly.diff')
-rw-r--r-- | web/attachments/121784-nagiosplug-cvs-silly.diff | 806 |
1 files changed, 806 insertions, 0 deletions
diff --git a/web/attachments/121784-nagiosplug-cvs-silly.diff b/web/attachments/121784-nagiosplug-cvs-silly.diff new file mode 100644 index 0000000..a518e81 --- /dev/null +++ b/web/attachments/121784-nagiosplug-cvs-silly.diff | |||
@@ -0,0 +1,806 @@ | |||
1 | diff -urN ./plugins/check_by_ssh.c ../plugins/plugins/check_by_ssh.c | ||
2 | --- ./plugins/check_by_ssh.c 2005-01-05 21:53:11.000000000 +0100 | ||
3 | +++ ../plugins/plugins/check_by_ssh.c 2005-02-17 13:19:35.000000000 +0100 | ||
4 | @@ -59,9 +59,9 @@ | ||
5 | time_t local_time; | ||
6 | FILE *fp = NULL; | ||
7 | |||
8 | - remotecmd = strdup (""); | ||
9 | - comm = strdup (SSH_COMMAND); | ||
10 | - result_text = strdup (""); | ||
11 | + remotecmd = ""; | ||
12 | + comm = SSH_COMMAND; | ||
13 | + result_text = ""; | ||
14 | |||
15 | setlocale (LC_ALL, ""); | ||
16 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
17 | @@ -137,7 +137,7 @@ | ||
18 | printf ("%s", result_text); | ||
19 | return result; | ||
20 | } | ||
21 | - asprintf (&output, "%s", result_text); | ||
22 | + output = result_text; | ||
23 | result_text = strnl (status_text); | ||
24 | eol = strpbrk (output, "\r\n"); | ||
25 | if (eol != NULL) | ||
26 | diff -urN ./plugins/check_dig.c ../plugins/plugins/check_dig.c | ||
27 | --- ./plugins/check_dig.c 2005-01-28 15:00:58.000000000 +0100 | ||
28 | +++ ../plugins/plugins/check_dig.c 2005-02-17 13:55:05.000000000 +0100 | ||
29 | @@ -59,7 +59,7 @@ | ||
30 | double elapsed_time; | ||
31 | int result = STATE_UNKNOWN; | ||
32 | |||
33 | - output = strdup (""); | ||
34 | + output = ""; | ||
35 | |||
36 | setlocale (LC_ALL, ""); | ||
37 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
38 | @@ -293,7 +293,7 @@ | ||
39 | } | ||
40 | } | ||
41 | else { | ||
42 | - dns_server = strdup ("127.0.0.1"); | ||
43 | + dns_server = "127.0.0.1"; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | diff -urN ./plugins/check_disk.c ../plugins/plugins/check_disk.c | ||
48 | --- ./plugins/check_disk.c 2005-01-05 21:53:12.000000000 +0100 | ||
49 | +++ ../plugins/plugins/check_disk.c 2005-02-17 13:12:09.000000000 +0100 | ||
50 | @@ -153,9 +153,9 @@ | ||
51 | struct fs_usage fsp; | ||
52 | struct name_list *temp_list; | ||
53 | |||
54 | - output = strdup (" - free space:"); | ||
55 | - details = strdup (""); | ||
56 | - perf = strdup (""); | ||
57 | + output = " - free space:"; | ||
58 | + details = ""; | ||
59 | + perf = ""; | ||
60 | |||
61 | setlocale (LC_ALL, ""); | ||
62 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
63 | @@ -283,7 +283,7 @@ | ||
64 | return ERROR; | ||
65 | |||
66 | se = (struct name_list *) malloc (sizeof (struct name_list)); | ||
67 | - se->name = strdup ("iso9660"); | ||
68 | + se->name = "iso9660"; | ||
69 | se->name_next = NULL; | ||
70 | *fstail = se; | ||
71 | fstail = &se->name_next; | ||
72 | @@ -346,19 +346,19 @@ | ||
73 | free(units); | ||
74 | if (! strcmp (optarg, "bytes")) { | ||
75 | mult = (uintmax_t)1; | ||
76 | - units = strdup ("B"); | ||
77 | + units = "B"; | ||
78 | } else if (! strcmp (optarg, "kB")) { | ||
79 | mult = (uintmax_t)1024; | ||
80 | - units = strdup ("kB"); | ||
81 | + units = "kB"; | ||
82 | } else if (! strcmp (optarg, "MB")) { | ||
83 | mult = (uintmax_t)1024 * 1024; | ||
84 | - units = strdup ("MB"); | ||
85 | + units = "MB"; | ||
86 | } else if (! strcmp (optarg, "GB")) { | ||
87 | mult = (uintmax_t)1024 * 1024 * 1024; | ||
88 | - units = strdup ("GB"); | ||
89 | + units = "GB"; | ||
90 | } else if (! strcmp (optarg, "TB")) { | ||
91 | mult = (uintmax_t)1024 * 1024 * 1024 * 1024; | ||
92 | - units = strdup ("TB"); | ||
93 | + units = "TB"; | ||
94 | } else { | ||
95 | die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); | ||
96 | } | ||
97 | @@ -369,13 +369,13 @@ | ||
98 | mult = 1024; | ||
99 | if (units) | ||
100 | free(units); | ||
101 | - units = strdup ("kB"); | ||
102 | + units = "kB"; | ||
103 | break; | ||
104 | case 'm': /* display mountpoint */ | ||
105 | mult = 1024 * 1024; | ||
106 | if (units) | ||
107 | free(units); | ||
108 | - units = strdup ("MB"); | ||
109 | + units = "MB"; | ||
110 | break; | ||
111 | case 'l': | ||
112 | show_local_fs = 1; | ||
113 | @@ -518,7 +518,7 @@ | ||
114 | } | ||
115 | |||
116 | if (units == NULL) { | ||
117 | - units = strdup ("MB"); | ||
118 | + units = "MB"; | ||
119 | mult = (uintmax_t)1024 * 1024; | ||
120 | } | ||
121 | return OK; | ||
122 | diff -urN ./plugins/check_game.c ../plugins/plugins/check_game.c | ||
123 | --- ./plugins/check_game.c 2005-01-05 21:53:13.000000000 +0100 | ||
124 | +++ ../plugins/plugins/check_game.c 2005-02-17 13:12:09.000000000 +0100 | ||
125 | @@ -110,7 +110,7 @@ | ||
126 | |||
127 | /* initialize the returned data buffer */ | ||
128 | for (i = 0; i < QSTAT_MAX_RETURN_ARGS; i++) | ||
129 | - ret[i] = strdup(""); | ||
130 | + ret[i] = ""; | ||
131 | |||
132 | i = 0; | ||
133 | p = (char *) strtok (input_buffer, QSTAT_DATA_DELIMITER); | ||
134 | diff -urN ./plugins/check_http.c ../plugins/plugins/check_http.c | ||
135 | --- ./plugins/check_http.c 2005-01-24 08:29:53.000000000 +0100 | ||
136 | +++ ../plugins/plugins/check_http.c 2005-02-17 15:34:59.000000000 +0100 | ||
137 | @@ -60,7 +60,6 @@ | ||
138 | #ifdef HAVE_SSL | ||
139 | int check_cert = FALSE; | ||
140 | int days_till_exp; | ||
141 | -char *randbuff; | ||
142 | SSL_CTX *ctx; | ||
143 | SSL *ssl; | ||
144 | X509 *server_cert; | ||
145 | @@ -357,7 +356,7 @@ | ||
146 | break; | ||
147 | case 'P': /* HTTP POST data in URL encoded format */ | ||
148 | if (http_method || http_post_data) break; | ||
149 | - http_method = strdup("POST"); | ||
150 | + http_method = "POST"; | ||
151 | http_post_data = strdup (optarg); | ||
152 | break; | ||
153 | case 's': /* string or substring */ | ||
154 | @@ -473,7 +472,7 @@ | ||
155 | socket_timeout = (int)critical_time + 1; | ||
156 | |||
157 | if (http_method == NULL) | ||
158 | - http_method = strdup ("GET"); | ||
159 | + http_method = "GET"; | ||
160 | |||
161 | return TRUE; | ||
162 | } | ||
163 | @@ -869,7 +868,7 @@ | ||
164 | #endif | ||
165 | |||
166 | /* fetch the page */ | ||
167 | - full_page = strdup(""); | ||
168 | + full_page = ""; | ||
169 | while ((i = my_recv ()) > 0) { | ||
170 | buffer[i] = '\0'; | ||
171 | asprintf (&full_page, "%s%s", full_page, buffer); | ||
172 | @@ -1250,8 +1249,9 @@ | ||
173 | int connect_SSL (void) | ||
174 | { | ||
175 | SSL_METHOD *meth; | ||
176 | - | ||
177 | - asprintf (&randbuff, "%s", "qwertyuiopasdfghjklqwertyuiopasdfghjkl"); | ||
178 | + char *randbuff; | ||
179 | + | ||
180 | + randbuff = "qwertyuiopasdfghjklqwertyuiopasdfghjkl"; | ||
181 | RAND_seed (randbuff, (int)strlen(randbuff)); | ||
182 | if (verbose) | ||
183 | printf(_("SSL seeding: %s\n"), (RAND_status()==1 ? _("OK") : _("Failed")) ); | ||
184 | diff -urN ./plugins/check_mrtg.c ../plugins/plugins/check_mrtg.c | ||
185 | --- ./plugins/check_mrtg.c 2005-01-05 21:53:15.000000000 +0100 | ||
186 | +++ ../plugins/plugins/check_mrtg.c 2005-02-17 15:58:02.000000000 +0100 | ||
187 | @@ -113,7 +113,7 @@ | ||
188 | /* if we couldn't read enough data, return an unknown error */ | ||
189 | if (line <= 2) { | ||
190 | result = STATE_UNKNOWN; | ||
191 | - asprintf (&message, _("Unable to process MRTG log file\n")); | ||
192 | + message = _("Unable to process MRTG log file\n"); | ||
193 | } | ||
194 | |||
195 | /* make sure the MRTG data isn't too old */ | ||
196 | @@ -122,8 +122,8 @@ | ||
197 | if (expire_minutes > 0 | ||
198 | && (current_time - timestamp) > (expire_minutes * 60)) { | ||
199 | result = STATE_WARNING; | ||
200 | - asprintf (&message, _("MRTG data has expired (%d minutes old)\n"), | ||
201 | - (int) ((current_time - timestamp) / 60)); | ||
202 | + message = _("MRTG data has expired (%d minutes old)\n"), | ||
203 | + (int) ((current_time - timestamp) / 60)); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | @@ -294,10 +294,10 @@ | ||
208 | usage4 (_("You must supply the variable number")); | ||
209 | |||
210 | if (label == NULL) | ||
211 | - label = strdup ("value"); | ||
212 | + label = "value"; | ||
213 | |||
214 | if (units == NULL) | ||
215 | - units = strdup (""); | ||
216 | + units = ""; | ||
217 | |||
218 | return OK; | ||
219 | } | ||
220 | diff -urN ./plugins/check_nt.c ../plugins/plugins/check_nt.c | ||
221 | --- ./plugins/check_nt.c 2005-02-17 13:01:02.000000000 +0100 | ||
222 | +++ ../plugins/plugins/check_nt.c 2005-02-17 16:18:53.000000000 +0100 | ||
223 | @@ -153,7 +153,7 @@ | ||
224 | /* -l parameters is present with only integers */ | ||
225 | return_code=STATE_OK; | ||
226 | temp_string = strdup (_("CPU Load")); | ||
227 | - temp_string_perf = strdup (" "); | ||
228 | + temp_string_perf = " "; | ||
229 | |||
230 | /* loop until one of the parameters is wrong or not present */ | ||
231 | while (lvalue_list[0+offset]> (unsigned long)0 && | ||
232 | @@ -327,7 +327,7 @@ | ||
233 | asprintf (&output_message, "%.f", counter_value); | ||
234 | else if (isPercent) | ||
235 | { | ||
236 | - counter_unit = strdup ("%"); | ||
237 | + counter_unit = "%"; | ||
238 | allRight = TRUE; | ||
239 | } | ||
240 | |||
241 | diff -urN ./plugins/check_nwstat.c ../plugins/plugins/check_nwstat.c | ||
242 | --- ./plugins/check_nwstat.c 2005-01-05 21:53:17.000000000 +0100 | ||
243 | +++ ../plugins/plugins/check_nwstat.c 2005-02-17 16:24:36.000000000 +0100 | ||
244 | @@ -135,18 +135,18 @@ | ||
245 | |||
246 | /* get OS version string */ | ||
247 | if (check_netware_version==TRUE) { | ||
248 | - send_buffer = strdup ("S19\r\n"); | ||
249 | + send_buffer = "S19\r\n"; | ||
250 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
251 | if (result!=STATE_OK) | ||
252 | return result; | ||
253 | if (!strcmp(recv_buffer,"-1\n")) | ||
254 | - netware_version = strdup(""); | ||
255 | + netware_version = ""; | ||
256 | else { | ||
257 | recv_buffer[strlen(recv_buffer)-1]=0; | ||
258 | asprintf (&netware_version,_("NetWare %s: "),recv_buffer); | ||
259 | } | ||
260 | } else | ||
261 | - netware_version = strdup(""); | ||
262 | + netware_version = ""; | ||
263 | |||
264 | |||
265 | /* check CPU load */ | ||
266 | @@ -154,13 +154,13 @@ | ||
267 | |||
268 | switch(vars_to_check) { | ||
269 | case LOAD1: | ||
270 | - temp_buffer = strdup ("1"); | ||
271 | + temp_buffer = "1"; | ||
272 | break; | ||
273 | case LOAD5: | ||
274 | - temp_buffer = strdup ("5"); | ||
275 | + temp_buffer = "5"; | ||
276 | break; | ||
277 | default: | ||
278 | - temp_buffer = strdup ("15"); | ||
279 | + temp_buffer = "15"; | ||
280 | break; | ||
281 | } | ||
282 | |||
283 | @@ -169,7 +169,7 @@ | ||
284 | if (result!=STATE_OK) | ||
285 | return result; | ||
286 | utilization=strtoul(recv_buffer,NULL,10); | ||
287 | - send_buffer = strdup ("UPTIME\r\n"); | ||
288 | + send_buffer = "UPTIME\r\n"; | ||
289 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
290 | if (result!=STATE_OK) | ||
291 | return result; | ||
292 | @@ -191,7 +191,7 @@ | ||
293 | /* check number of user connections */ | ||
294 | } else if (vars_to_check==CONNS) { | ||
295 | |||
296 | - send_buffer = strdup ("CONNECT\r\n"); | ||
297 | + send_buffer = "CONNECT\r\n"; | ||
298 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
299 | if (result!=STATE_OK) | ||
300 | return result; | ||
301 | @@ -210,7 +210,7 @@ | ||
302 | /* check % long term cache hits */ | ||
303 | } else if (vars_to_check==LTCH) { | ||
304 | |||
305 | - send_buffer = strdup ("S1\r\n"); | ||
306 | + send_buffer = "S1\r\n"; | ||
307 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
308 | if (result!=STATE_OK) | ||
309 | return result; | ||
310 | @@ -229,7 +229,7 @@ | ||
311 | /* check cache buffers */ | ||
312 | } else if (vars_to_check==CBUFF) { | ||
313 | |||
314 | - send_buffer = strdup ("S2\r\n"); | ||
315 | + send_buffer = "S2\r\n"; | ||
316 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
317 | if (result!=STATE_OK) | ||
318 | return result; | ||
319 | @@ -248,7 +248,7 @@ | ||
320 | /* check dirty cache buffers */ | ||
321 | } else if (vars_to_check==CDBUFF) { | ||
322 | |||
323 | - send_buffer = strdup ("S3\r\n"); | ||
324 | + send_buffer = "S3\r\n"; | ||
325 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
326 | if (result!=STATE_OK) | ||
327 | return result; | ||
328 | @@ -267,7 +267,7 @@ | ||
329 | /* check LRU sitting time in minutes */ | ||
330 | } else if (vars_to_check==LRUM) { | ||
331 | |||
332 | - send_buffer = strdup ("S5\r\n"); | ||
333 | + send_buffer = "S5\r\n"; | ||
334 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
335 | if (result!=STATE_OK) | ||
336 | return result; | ||
337 | @@ -344,7 +344,7 @@ | ||
338 | /* check to see if DS Database is open or closed */ | ||
339 | } else if (vars_to_check==DSDB) { | ||
340 | |||
341 | - send_buffer = strdup ("S11\r\n"); | ||
342 | + send_buffer = "S11\r\n"; | ||
343 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
344 | if (result!=STATE_OK) | ||
345 | return result; | ||
346 | @@ -353,7 +353,7 @@ | ||
347 | else | ||
348 | result=STATE_WARNING; | ||
349 | |||
350 | - send_buffer = strdup ("S13\r\n"); | ||
351 | + send_buffer = "S13\r\n"; | ||
352 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
353 | temp_buffer=strtok(recv_buffer,"\r\n"); | ||
354 | |||
355 | @@ -362,7 +362,7 @@ | ||
356 | /* check to see if logins are enabled */ | ||
357 | } else if (vars_to_check==LOGINS) { | ||
358 | |||
359 | - send_buffer = strdup ("S12\r\n"); | ||
360 | + send_buffer = "S12\r\n"; | ||
361 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
362 | if (result!=STATE_OK) | ||
363 | return result; | ||
364 | @@ -617,7 +617,7 @@ | ||
365 | /* check LRU sitting time in secondss */ | ||
366 | } else if (vars_to_check==LRUS) { | ||
367 | |||
368 | - send_buffer = strdup ("S4\r\n"); | ||
369 | + send_buffer = "S4\r\n"; | ||
370 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
371 | if (result!=STATE_OK) | ||
372 | return result; | ||
373 | @@ -633,7 +633,7 @@ | ||
374 | /* check % dirty cacheobuffers as a percentage of the total*/ | ||
375 | } else if (vars_to_check==DCB) { | ||
376 | |||
377 | - send_buffer = strdup ("S6\r\n"); | ||
378 | + send_buffer = "S6\r\n"; | ||
379 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
380 | if (result!=STATE_OK) | ||
381 | return result; | ||
382 | @@ -648,7 +648,7 @@ | ||
383 | /* check % total cache buffers as a percentage of the original*/ | ||
384 | } else if (vars_to_check==TCB) { | ||
385 | |||
386 | - send_buffer = strdup ("S7\r\n"); | ||
387 | + send_buffer = "S7\r\n"; | ||
388 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | ||
389 | if (result!=STATE_OK) | ||
390 | return result; | ||
391 | @@ -695,7 +695,7 @@ | ||
392 | |||
393 | } else { | ||
394 | |||
395 | - output_message = strdup (_("Nothing to check!\n")); | ||
396 | + output_message = _("Nothing to check!\n"); | ||
397 | result=STATE_UNKNOWN; | ||
398 | |||
399 | } | ||
400 | @@ -806,15 +806,15 @@ | ||
401 | vars_to_check=LRUS; | ||
402 | else if (strncmp(optarg,"VPF",3)==0) { | ||
403 | vars_to_check=VPF; | ||
404 | - volume_name = strdup (optarg+3); | ||
405 | + volume_name = optarg+3; | ||
406 | if (!strcmp(volume_name,"")) | ||
407 | - volume_name = strdup ("SYS"); | ||
408 | + volume_name = "SYS"; | ||
409 | } | ||
410 | else if (strncmp(optarg,"VKF",3)==0) { | ||
411 | vars_to_check=VKF; | ||
412 | - volume_name = strdup (optarg+3); | ||
413 | + volume_name = optarg+3; | ||
414 | if (!strcmp(volume_name,"")) | ||
415 | - volume_name = strdup ("SYS"); | ||
416 | + volume_name = "SYS"; | ||
417 | } | ||
418 | else if (!strcmp(optarg,"DSDB")) | ||
419 | vars_to_check=DSDB; | ||
420 | @@ -835,27 +835,27 @@ | ||
421 | vars_to_check=OFILES; | ||
422 | else if (strncmp(optarg,"VKP",3)==0) { | ||
423 | vars_to_check=VKP; | ||
424 | - volume_name = strdup (optarg+3); | ||
425 | + volume_name = optarg+3; | ||
426 | if (!strcmp(volume_name,"")) | ||
427 | - volume_name = strdup ("SYS"); | ||
428 | + volume_name = "SYS"; | ||
429 | } | ||
430 | else if (strncmp(optarg,"VPP",3)==0) { | ||
431 | vars_to_check=VPP; | ||
432 | - volume_name = strdup (optarg+3); | ||
433 | + volume_name = optarg+3; | ||
434 | if (!strcmp(volume_name,"")) | ||
435 | - volume_name = strdup ("SYS"); | ||
436 | + volume_name = "SYS"; | ||
437 | } | ||
438 | else if (strncmp(optarg,"VKNP",4)==0) { | ||
439 | vars_to_check=VKNP; | ||
440 | - volume_name = strdup (optarg+4); | ||
441 | + volume_name = optarg+4; | ||
442 | if (!strcmp(volume_name,"")) | ||
443 | - volume_name = strdup ("SYS"); | ||
444 | + volume_name = "SYS"; | ||
445 | } | ||
446 | else if (strncmp(optarg,"VPNP",4)==0) { | ||
447 | vars_to_check=VPNP; | ||
448 | - volume_name = strdup (optarg+4); | ||
449 | + volume_name = optarg+4; | ||
450 | if (!strcmp(volume_name,"")) | ||
451 | - volume_name = strdup("SYS"); | ||
452 | + volume_name = "SYS"; | ||
453 | } | ||
454 | else if (!strcmp(optarg,"ABENDS")) | ||
455 | vars_to_check=ABENDS; | ||
456 | @@ -869,7 +869,7 @@ | ||
457 | vars_to_check=UPTIME; | ||
458 | else if (strncmp(optarg,"NLM:",4)==0) { | ||
459 | vars_to_check=NLM; | ||
460 | - nlm_name=strdup (optarg+4); | ||
461 | + nlm_name = optarg+4; | ||
462 | } | ||
463 | else | ||
464 | return ERROR; | ||
465 | diff -urN ./plugins/check_ping.c ../plugins/plugins/check_ping.c | ||
466 | --- ./plugins/check_ping.c 2005-01-05 21:53:17.000000000 +0100 | ||
467 | +++ ../plugins/plugins/check_ping.c 2005-02-17 16:29:41.000000000 +0100 | ||
468 | @@ -93,11 +93,11 @@ | ||
469 | |||
470 | #ifdef PING6_COMMAND | ||
471 | if (is_inet6_addr(addresses[i]) && address_family != AF_INET) | ||
472 | - rawcmd = strdup(PING6_COMMAND); | ||
473 | + rawcmd = PING6_COMMAND; | ||
474 | else | ||
475 | - rawcmd = strdup(PING_COMMAND); | ||
476 | + rawcmd = PING_COMMAND; | ||
477 | #else | ||
478 | - rawcmd = strdup(PING_COMMAND); | ||
479 | + rawcmd = PING_COMMAND; | ||
480 | #endif | ||
481 | |||
482 | /* does the host address of number of packets argument come first? */ | ||
483 | @@ -452,7 +452,7 @@ | ||
484 | result = max_state (result, STATE_WARNING); | ||
485 | |||
486 | if (warn_text == NULL) | ||
487 | - warn_text = strdup(""); | ||
488 | + warn_text = ""; | ||
489 | |||
490 | return result; | ||
491 | } | ||
492 | @@ -473,7 +473,7 @@ | ||
493 | |||
494 | if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) { | ||
495 | if (warn_text == NULL) | ||
496 | - warn_text = strdup (_(WARN_DUPLICATES)); | ||
497 | + warn_text = _(WARN_DUPLICATES); | ||
498 | else if (! strstr (warn_text, _(WARN_DUPLICATES)) && | ||
499 | asprintf (&warn_text, "%s %s", warn_text, _(WARN_DUPLICATES)) == -1) | ||
500 | die (STATE_UNKNOWN, _("Unable to realloc warn_text")); | ||
501 | diff -urN ./plugins/check_procs.c ../plugins/plugins/check_procs.c | ||
502 | --- ./plugins/check_procs.c 2005-01-05 21:53:18.000000000 +0100 | ||
503 | +++ ../plugins/plugins/check_procs.c 2005-02-17 16:35:49.000000000 +0100 | ||
504 | @@ -117,7 +117,7 @@ | ||
505 | input_buffer = malloc (MAX_INPUT_BUFFER); | ||
506 | procprog = malloc (MAX_INPUT_BUFFER); | ||
507 | |||
508 | - asprintf (&metric_name, "PROCS"); | ||
509 | + metric_name = "PROCS"; | ||
510 | metric = METRIC_PROCS; | ||
511 | |||
512 | if (process_arguments (argc, argv) == ERROR) | ||
513 | @@ -147,8 +147,8 @@ | ||
514 | while ( input_buffer[strlen(input_buffer)-1] != '\n' ) | ||
515 | fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
516 | |||
517 | + input_line = ""; | ||
518 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { | ||
519 | - asprintf (&input_line, "%s", input_buffer); | ||
520 | while ( input_buffer[strlen(input_buffer)-1] != '\n' ) { | ||
521 | fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process); | ||
522 | asprintf (&input_line, "%s%s", input_line, input_buffer); | ||
523 | @@ -157,8 +157,8 @@ | ||
524 | if (verbose >= 3) | ||
525 | printf ("%s", input_line); | ||
526 | |||
527 | - strcpy (procprog, ""); | ||
528 | - asprintf (&procargs, "%s", ""); | ||
529 | + *procprog = '\x0'; | ||
530 | + procargs = ""; | ||
531 | |||
532 | cols = sscanf (input_line, PS_FORMAT, PS_VARLIST); | ||
533 | |||
534 | @@ -493,7 +493,7 @@ | ||
535 | if (cmax == -1 && argv[c]) | ||
536 | cmax = atoi (argv[c++]); | ||
537 | if (statopts == NULL && argv[c]) { | ||
538 | - asprintf (&statopts, "%s", argv[c++]); | ||
539 | + statopts = argv[c++]; | ||
540 | asprintf (&fmt, _("%s%sSTATE = %s"), (fmt ? fmt : ""), (options ? ", " : ""), statopts); | ||
541 | options |= STAT; | ||
542 | } | ||
543 | @@ -531,19 +531,19 @@ | ||
544 | options = ALL; | ||
545 | |||
546 | if (statopts==NULL) | ||
547 | - statopts = strdup(""); | ||
548 | + statopts = ""; | ||
549 | |||
550 | if (prog==NULL) | ||
551 | - prog = strdup(""); | ||
552 | + prog = ""; | ||
553 | |||
554 | if (args==NULL) | ||
555 | - args = strdup(""); | ||
556 | + args = ""; | ||
557 | |||
558 | if (fmt==NULL) | ||
559 | - fmt = strdup(""); | ||
560 | + fmt = ""; | ||
561 | |||
562 | if (fails==NULL) | ||
563 | - fails = strdup(""); | ||
564 | + fails = ""; | ||
565 | |||
566 | return options; | ||
567 | } | ||
568 | diff -urN ./plugins/check_radius.c ../plugins/plugins/check_radius.c | ||
569 | --- ./plugins/check_radius.c 2005-01-05 21:53:18.000000000 +0100 | ||
570 | +++ ../plugins/plugins/check_radius.c 2005-02-17 13:12:10.000000000 +0100 | ||
571 | @@ -116,7 +116,7 @@ | ||
572 | if (process_arguments (argc, argv) == ERROR) | ||
573 | usage4 (_("Could not parse arguments")); | ||
574 | |||
575 | - str = strdup ("dictionary"); | ||
576 | + str = "dictionary"; | ||
577 | if ((config_file && rc_read_config (config_file)) || | ||
578 | rc_read_dictionary (rc_conf_str (str))) | ||
579 | die (STATE_UNKNOWN, _("Config file error")); | ||
580 | diff -urN ./plugins/check_real.c ../plugins/plugins/check_real.c | ||
581 | --- ./plugins/check_real.c 2005-01-05 21:53:18.000000000 +0100 | ||
582 | +++ ../plugins/plugins/check_real.c 2005-02-17 16:36:39.000000000 +0100 | ||
583 | @@ -369,7 +369,7 @@ | ||
584 | usage4 (_("You must provide a server to check")); | ||
585 | |||
586 | if (host_name==NULL) | ||
587 | - host_name = strdup (server_address); | ||
588 | + host_name = server_address; | ||
589 | |||
590 | if (server_expect == NULL) | ||
591 | server_expect = strdup(EXPECT); | ||
592 | diff -urN ./plugins/check_smtp.c ../plugins/plugins/check_smtp.c | ||
593 | --- ./plugins/check_smtp.c 2005-01-05 21:53:18.000000000 +0100 | ||
594 | +++ ../plugins/plugins/check_smtp.c 2005-02-17 16:38:24.000000000 +0100 | ||
595 | @@ -486,18 +486,18 @@ | ||
596 | usage2 (_("Invalid hostname/address"), argv[c]); | ||
597 | } | ||
598 | else { | ||
599 | - asprintf (&server_address, "127.0.0.1"); | ||
600 | + server_address = "127.0.0.1"; | ||
601 | } | ||
602 | } | ||
603 | |||
604 | if (server_expect == NULL) | ||
605 | - server_expect = strdup (SMTP_EXPECT); | ||
606 | + server_expect = SMTP_EXPECT; | ||
607 | |||
608 | if (mail_command == NULL) | ||
609 | - mail_command = strdup("MAIL "); | ||
610 | + mail_command = "MAIL "; | ||
611 | |||
612 | if (from_arg==NULL) | ||
613 | - from_arg = strdup(" "); | ||
614 | + from_arg = " "; | ||
615 | |||
616 | return validate_arguments (); | ||
617 | } | ||
618 | diff -urN ./plugins/check_swap.c ../plugins/plugins/check_swap.c | ||
619 | --- ./plugins/check_swap.c 2005-01-24 08:29:54.000000000 +0100 | ||
620 | +++ ../plugins/plugins/check_swap.c 2005-02-17 16:56:09.000000000 +0100 | ||
621 | @@ -85,9 +85,9 @@ | ||
622 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
623 | textdomain (PACKAGE); | ||
624 | |||
625 | - status = strdup (""); | ||
626 | - tmp_status = strdup (""); | ||
627 | - perf = strdup (""); | ||
628 | + status = ""; | ||
629 | + tmp_status = ""; | ||
630 | + perf = ""; | ||
631 | |||
632 | if (process_arguments (argc, argv) == ERROR) | ||
633 | usage4 (_("Could not parse arguments")); | ||
634 | @@ -128,15 +128,15 @@ | ||
635 | free_swap = dskfree; | ||
636 | #else | ||
637 | # ifdef HAVE_SWAP | ||
638 | - asprintf(&swap_command, "%s", SWAP_COMMAND); | ||
639 | - asprintf(&swap_format, "%s", SWAP_FORMAT); | ||
640 | + swap_command = SWAP_COMMAND; | ||
641 | + swap_format = SWAP_FORMAT; | ||
642 | |||
643 | /* These override the command used if a summary (and thus ! allswaps) is required */ | ||
644 | /* The summary flag returns more accurate information about swap usage on these OSes */ | ||
645 | # ifdef _AIX | ||
646 | if (!allswaps) { | ||
647 | - asprintf(&swap_command, "%s", "/usr/sbin/lsps -s"); | ||
648 | - asprintf(&swap_format, "%s", "%f%*s %f"); | ||
649 | + swap_command = "/usr/sbin/lsps -s"; | ||
650 | + swap_format = "%f%*s %f"; | ||
651 | conv_factor = 1; | ||
652 | } | ||
653 | # endif | ||
654 | diff -urN ./plugins/check_udp.c ../plugins/plugins/check_udp.c | ||
655 | --- ./plugins/check_udp.c 2005-01-05 21:53:21.000000000 +0100 | ||
656 | +++ ../plugins/plugins/check_udp.c 2005-02-17 13:12:10.000000000 +0100 | ||
657 | @@ -207,7 +207,7 @@ | ||
658 | usage4 (_("Hostname was not supplied")); | ||
659 | |||
660 | if (server_send == NULL) | ||
661 | - server_send = strdup(""); | ||
662 | + server_send = ""; | ||
663 | |||
664 | return c; | ||
665 | } | ||
666 | diff -urN ./plugins/check_ups.c ../plugins/plugins/check_ups.c | ||
667 | --- ./plugins/check_ups.c 2005-01-05 21:53:22.000000000 +0100 | ||
668 | +++ ../plugins/plugins/check_ups.c 2005-02-17 18:21:59.000000000 +0100 | ||
669 | @@ -106,9 +106,9 @@ | ||
670 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
671 | textdomain (PACKAGE); | ||
672 | |||
673 | - ups_status = strdup ("N/A"); | ||
674 | - data = strdup (""); | ||
675 | - message = strdup (""); | ||
676 | + ups_status = "N/A"; | ||
677 | + data = ""; | ||
678 | + message = ""; | ||
679 | |||
680 | if (process_arguments (argc, argv) == ERROR) | ||
681 | usage4 (_("Could not parse arguments")); | ||
682 | @@ -124,16 +124,16 @@ | ||
683 | return STATE_CRITICAL; | ||
684 | if (supported_options & UPS_STATUS) { | ||
685 | |||
686 | - ups_status = strdup (""); | ||
687 | + ups_status = ""; | ||
688 | result = STATE_OK; | ||
689 | |||
690 | if (status & UPSSTATUS_OFF) { | ||
691 | - asprintf (&ups_status, "Off"); | ||
692 | + ups_status = "Off"; | ||
693 | result = STATE_CRITICAL; | ||
694 | } | ||
695 | else if ((status & (UPSSTATUS_OB | UPSSTATUS_LB)) == | ||
696 | (UPSSTATUS_OB | UPSSTATUS_LB)) { | ||
697 | - asprintf (&ups_status, _("On Battery, Low Battery")); | ||
698 | + ups_status = _("On Battery, Low Battery"); | ||
699 | result = STATE_CRITICAL; | ||
700 | } | ||
701 | else { | ||
702 | @@ -203,15 +203,13 @@ | ||
703 | else if (check_warn==TRUE && ups_utility_deviation>=warning_value) { | ||
704 | result = max_state (result, STATE_WARNING); | ||
705 | } | ||
706 | - asprintf (&data, "%s", | ||
707 | - perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
708 | - check_warn, (long)(1000*warning_value), | ||
709 | - check_crit, (long)(1000*critical_value), | ||
710 | - TRUE, 0, FALSE, 0)); | ||
711 | + data = perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
712 | + check_warn, (long)(1000*warning_value), | ||
713 | + check_crit, (long)(1000*critical_value), | ||
714 | + TRUE, 0, FALSE, 0)); | ||
715 | } else { | ||
716 | - asprintf (&data, "%s", | ||
717 | - perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
718 | - FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
719 | + data = perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | ||
720 | + FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | ||
721 | } | ||
722 | } | ||
723 | |||
724 | @@ -560,7 +558,7 @@ | ||
725 | } | ||
726 | |||
727 | if (server_address == NULL) | ||
728 | - server_address = strdup("127.0.0.1"); | ||
729 | + server_address = "127.0.0.1"; | ||
730 | |||
731 | return validate_arguments(); | ||
732 | } | ||
733 | diff -urN ./plugins/check_users.c ../plugins/plugins/check_users.c | ||
734 | --- ./plugins/check_users.c 2005-01-05 21:53:22.000000000 +0100 | ||
735 | +++ ../plugins/plugins/check_users.c 2005-02-17 18:22:57.000000000 +0100 | ||
736 | @@ -48,7 +48,7 @@ | ||
737 | bindtextdomain (PACKAGE, LOCALEDIR); | ||
738 | textdomain (PACKAGE); | ||
739 | |||
740 | - perf = strdup(""); | ||
741 | + perf = ""; | ||
742 | |||
743 | if (process_arguments (argc, argv) == ERROR) | ||
744 | usage4 (_("Could not parse arguments")); | ||
745 | @@ -100,11 +100,8 @@ | ||
746 | if (result == STATE_UNKNOWN) | ||
747 | printf (_("Unable to read output\n")); | ||
748 | else { | ||
749 | - asprintf(&perf, "%s", perfdata ("users", users, "", | ||
750 | - TRUE, wusers, | ||
751 | - TRUE, cusers, | ||
752 | - TRUE, 0, | ||
753 | - FALSE, 0)); | ||
754 | + perf = perfdata ("users", users, "", TRUE, wusers, TRUE, cusers, | ||
755 | + TRUE, 0, FALSE, 0)); | ||
756 | printf (_("USERS %s - %d users currently logged in |%s\n"), state_text (result), | ||
757 | users, perf); | ||
758 | } | ||
759 | diff -urN ./plugins/negate.c ../plugins/plugins/negate.c | ||
760 | --- ./plugins/negate.c 2005-01-05 21:53:22.000000000 +0100 | ||
761 | +++ ../plugins/plugins/negate.c 2005-02-17 18:24:35.000000000 +0100 | ||
762 | @@ -192,7 +192,7 @@ | ||
763 | } | ||
764 | } | ||
765 | |||
766 | - asprintf (&command_line, "%s", argv[optind]); | ||
767 | + command_line = argv[optind]; | ||
768 | for (c = optind+1; c < argc; c++) { | ||
769 | asprintf (&command_line, "%s %s", command_line, argv[c]); | ||
770 | } | ||
771 | diff -urN ./plugins/popen.c ../plugins/plugins/popen.c | ||
772 | --- ./plugins/popen.c 2005-01-05 21:53:22.000000000 +0100 | ||
773 | +++ ../plugins/plugins/popen.c 2005-02-17 13:12:11.000000000 +0100 | ||
774 | @@ -87,7 +87,7 @@ | ||
775 | setrlimit (RLIMIT_CORE, &limit); | ||
776 | #endif | ||
777 | |||
778 | - env[0] = strdup("LC_ALL=C"); | ||
779 | + env[0] = "LC_ALL=C"; | ||
780 | env[1] = '\0'; | ||
781 | |||
782 | /* if no command was passed, return with no error */ | ||
783 | diff -urN ./plugins/urlize.c ../plugins/plugins/urlize.c | ||
784 | --- ./plugins/urlize.c 2005-01-05 21:53:23.000000000 +0100 | ||
785 | +++ ../plugins/plugins/urlize.c 2005-02-17 18:28:19.000000000 +0100 | ||
786 | @@ -67,7 +67,7 @@ | ||
787 | exit (EXIT_SUCCESS); | ||
788 | break; | ||
789 | case 'u': | ||
790 | - url = strdup (argv[optind]); | ||
791 | + url = argv[optind]; | ||
792 | break; | ||
793 | case '?': | ||
794 | default: | ||
795 | @@ -76,9 +76,9 @@ | ||
796 | } | ||
797 | |||
798 | if (url == NULL) | ||
799 | - url = strdup (argv[optind++]); | ||
800 | + url = argv[optind++]; | ||
801 | |||
802 | - cmd = strdup (argv[optind++]); | ||
803 | + cmd = argv[optind++]; | ||
804 | for (c = optind; c < argc; c++) { | ||
805 | asprintf (&cmd, "%s %s", cmd, argv[c]); | ||
806 | } | ||