diff options
| author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-09-02 15:04:02 +0000 |
|---|---|---|
| committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-09-02 15:04:02 +0000 |
| commit | e36840962a92049b9548938e9233eb3cdfbd540d (patch) | |
| tree | 18d1c20db52c115e2ee5aaafa3a1b84e2ebe6a7b /plugins | |
| parent | 11c3ddab4a62befefa8fbf5c1c0e923595b15142 (diff) | |
| download | monitoring-plugins-e36840962a92049b9548938e9233eb3cdfbd540d.tar.gz | |
Solaris requires asprintf checks for null variables
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@709 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_procs.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 8a3f7ac2..e0ee524c 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
| @@ -259,8 +259,8 @@ main (int argc, char **argv) | |||
| 259 | } | 259 | } |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | if (fmt != "") { | 262 | if (strcmp(fmt,"") != 0) { |
| 263 | printf (" with %s", fmt); | 263 | printf (_(" with %s"), fmt); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | if ( verbose >= 1 && fails != "" ) | 266 | if ( verbose >= 1 && fails != "" ) |
| @@ -354,7 +354,7 @@ process_arguments (int argc, char **argv) | |||
| 354 | break; | 354 | break; |
| 355 | case 'p': /* process id */ | 355 | case 'p': /* process id */ |
| 356 | if (sscanf (optarg, "%d%[^0-9]", &ppid, tmp) == 1) { | 356 | if (sscanf (optarg, "%d%[^0-9]", &ppid, tmp) == 1) { |
| 357 | asprintf (&fmt, "%s%sPPID = %d", fmt, (options ? ", " : ""), ppid); | 357 | asprintf (&fmt, "%s%sPPID = %d", (fmt ? fmt : "") , (options ? ", " : ""), ppid); |
| 358 | options |= PPID; | 358 | options |= PPID; |
| 359 | break; | 359 | break; |
| 360 | } | 360 | } |
| @@ -367,7 +367,7 @@ process_arguments (int argc, char **argv) | |||
| 367 | break; | 367 | break; |
| 368 | else | 368 | else |
| 369 | statopts = optarg; | 369 | statopts = optarg; |
| 370 | asprintf (&fmt, _("%s%sSTATE = %s"), fmt, (options ? ", " : ""), statopts); | 370 | asprintf (&fmt, _("%s%sSTATE = %s"), (fmt ? fmt : ""), (options ? ", " : ""), statopts); |
| 371 | options |= STAT; | 371 | options |= STAT; |
| 372 | break; | 372 | break; |
| 373 | case 'u': /* user or user id */ | 373 | case 'u': /* user or user id */ |
| @@ -393,7 +393,7 @@ process_arguments (int argc, char **argv) | |||
| 393 | uid = pw->pw_uid; | 393 | uid = pw->pw_uid; |
| 394 | } | 394 | } |
| 395 | user = pw->pw_name; | 395 | user = pw->pw_name; |
| 396 | asprintf (&fmt, _("%s%sUID = %d (%s)"), fmt, (options ? ", " : ""), | 396 | asprintf (&fmt, _("%s%sUID = %d (%s)"), (fmt ? fmt : ""), (options ? ", " : ""), |
| 397 | uid, user); | 397 | uid, user); |
| 398 | options |= USER; | 398 | options |= USER; |
| 399 | break; | 399 | break; |
| @@ -402,7 +402,7 @@ process_arguments (int argc, char **argv) | |||
| 402 | break; | 402 | break; |
| 403 | else | 403 | else |
| 404 | prog = optarg; | 404 | prog = optarg; |
| 405 | asprintf (&fmt, _("%s%scommand name '%s'"), fmt, (options ? ", " : ""), | 405 | asprintf (&fmt, _("%s%scommand name '%s'"), (fmt ? fmt : ""), (options ? ", " : ""), |
| 406 | prog); | 406 | prog); |
| 407 | options |= PROG; | 407 | options |= PROG; |
| 408 | break; | 408 | break; |
| @@ -411,12 +411,12 @@ process_arguments (int argc, char **argv) | |||
| 411 | break; | 411 | break; |
| 412 | else | 412 | else |
| 413 | args = optarg; | 413 | args = optarg; |
| 414 | asprintf (&fmt, _("%s%sargs '%s'"), fmt, (options ? ", " : ""), args); | 414 | asprintf (&fmt, _("%s%sargs '%s'"), (fmt ? fmt : ""), (options ? ", " : ""), args); |
| 415 | options |= ARGS; | 415 | options |= ARGS; |
| 416 | break; | 416 | break; |
| 417 | case 'r': /* RSS */ | 417 | case 'r': /* RSS */ |
| 418 | if (sscanf (optarg, "%d%[^0-9]", &rss, tmp) == 1) { | 418 | if (sscanf (optarg, "%d%[^0-9]", &rss, tmp) == 1) { |
| 419 | asprintf (&fmt, _("%s%sRSS >= %d"), fmt, (options ? ", " : ""), rss); | 419 | asprintf (&fmt, _("%s%sRSS >= %d"), (fmt ? fmt : ""), (options ? ", " : ""), rss); |
| 420 | options |= RSS; | 420 | options |= RSS; |
| 421 | break; | 421 | break; |
| 422 | } | 422 | } |
| @@ -426,7 +426,7 @@ process_arguments (int argc, char **argv) | |||
| 426 | exit (STATE_UNKNOWN); | 426 | exit (STATE_UNKNOWN); |
| 427 | case 'z': /* VSZ */ | 427 | case 'z': /* VSZ */ |
| 428 | if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) { | 428 | if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) { |
| 429 | asprintf (&fmt, _("%s%sVSZ >= %d"), fmt, (options ? ", " : ""), vsz); | 429 | asprintf (&fmt, _("%s%sVSZ >= %d"), (fmt ? fmt : ""), (options ? ", " : ""), vsz); |
| 430 | options |= VSZ; | 430 | options |= VSZ; |
| 431 | break; | 431 | break; |
| 432 | } | 432 | } |
| @@ -437,7 +437,7 @@ process_arguments (int argc, char **argv) | |||
| 437 | case 'P': /* PCPU */ | 437 | case 'P': /* PCPU */ |
| 438 | /* TODO: -P 1.5.5 is accepted */ | 438 | /* TODO: -P 1.5.5 is accepted */ |
| 439 | if (sscanf (optarg, "%f%[^0-9.]", &pcpu, tmp) == 1) { | 439 | if (sscanf (optarg, "%f%[^0-9.]", &pcpu, tmp) == 1) { |
| 440 | asprintf (&fmt, _("%s%sPCPU >= %.2f"), fmt, (options ? ", " : ""), pcpu); | 440 | asprintf (&fmt, _("%s%sPCPU >= %.2f"), (fmt ? fmt : ""), (options ? ", " : ""), pcpu); |
| 441 | options |= PCPU; | 441 | options |= PCPU; |
| 442 | break; | 442 | break; |
| 443 | } | 443 | } |
| @@ -480,7 +480,7 @@ process_arguments (int argc, char **argv) | |||
| 480 | cmax = atoi (argv[c++]); | 480 | cmax = atoi (argv[c++]); |
| 481 | if (statopts == NULL && argv[c]) { | 481 | if (statopts == NULL && argv[c]) { |
| 482 | asprintf (&statopts, "%s", argv[c++]); | 482 | asprintf (&statopts, "%s", argv[c++]); |
| 483 | asprintf (&fmt, _("%s%sSTATE = %s"), fmt, (options ? ", " : ""), statopts); | 483 | asprintf (&fmt, _("%s%sSTATE = %s"), (fmt ? fmt : ""), (options ? ", " : ""), statopts); |
| 484 | options |= STAT; | 484 | options |= STAT; |
| 485 | } | 485 | } |
| 486 | 486 | ||
