[Nagiosplug-checkins] CVS: nagiosplug/plugins check_procs.c,1.20,1.21

Ton Voon tonvoon at users.sourceforge.net
Tue Sep 2 08:05:02 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv4837

Modified Files:
	check_procs.c 
Log Message:
Solaris requires asprintf checks for null variables


Index: check_procs.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_procs.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** check_procs.c	22 Aug 2003 06:22:38 -0000	1.20
--- check_procs.c	2 Sep 2003 15:04:02 -0000	1.21
***************
*** 260,265 ****
  	} 
  	
! 	if (fmt != "") {
! 		printf (" with %s", fmt);
  	}
  
--- 260,265 ----
  	} 
  	
! 	if (strcmp(fmt,"") != 0) {
! 		printf (_(" with %s"), fmt);
  	}
  
***************
*** 355,359 ****
  		case 'p':									/* process id */
  			if (sscanf (optarg, "%d%[^0-9]", &ppid, tmp) == 1) {
! 				asprintf (&fmt, "%s%sPPID = %d", fmt, (options ? ", " : ""), ppid);
  				options |= PPID;
  				break;
--- 355,359 ----
  		case 'p':									/* process id */
  			if (sscanf (optarg, "%d%[^0-9]", &ppid, tmp) == 1) {
! 				asprintf (&fmt, "%s%sPPID = %d", (fmt ? fmt : "") , (options ? ", " : ""), ppid);
  				options |= PPID;
  				break;
***************
*** 368,372 ****
  			else
  				statopts = optarg;
! 			asprintf (&fmt, _("%s%sSTATE = %s"), fmt, (options ? ", " : ""), statopts);
  			options |= STAT;
  			break;
--- 368,372 ----
  			else
  				statopts = optarg;
! 			asprintf (&fmt, _("%s%sSTATE = %s"), (fmt ? fmt : ""), (options ? ", " : ""), statopts);
  			options |= STAT;
  			break;
***************
*** 394,398 ****
  			}
  			user = pw->pw_name;
! 			asprintf (&fmt, _("%s%sUID = %d (%s)"), fmt, (options ? ", " : ""),
  			          uid, user);
  			options |= USER;
--- 394,398 ----
  			}
  			user = pw->pw_name;
! 			asprintf (&fmt, _("%s%sUID = %d (%s)"), (fmt ? fmt : ""), (options ? ", " : ""),
  			          uid, user);
  			options |= USER;
***************
*** 403,407 ****
  			else
  				prog = optarg;
! 			asprintf (&fmt, _("%s%scommand name '%s'"), fmt, (options ? ", " : ""),
  			          prog);
  			options |= PROG;
--- 403,407 ----
  			else
  				prog = optarg;
! 			asprintf (&fmt, _("%s%scommand name '%s'"), (fmt ? fmt : ""), (options ? ", " : ""),
  			          prog);
  			options |= PROG;
***************
*** 412,421 ****
  			else
  				args = optarg;
! 			asprintf (&fmt, _("%s%sargs '%s'"), fmt, (options ? ", " : ""), args);
  			options |= ARGS;
  			break;
  		case 'r': 					/* RSS */
  			if (sscanf (optarg, "%d%[^0-9]", &rss, tmp) == 1) {
! 				asprintf (&fmt, _("%s%sRSS >= %d"), fmt, (options ? ", " : ""), rss);
  				options |= RSS;
  				break;
--- 412,421 ----
  			else
  				args = optarg;
! 			asprintf (&fmt, _("%s%sargs '%s'"), (fmt ? fmt : ""), (options ? ", " : ""), args);
  			options |= ARGS;
  			break;
  		case 'r': 					/* RSS */
  			if (sscanf (optarg, "%d%[^0-9]", &rss, tmp) == 1) {
! 				asprintf (&fmt, _("%s%sRSS >= %d"), (fmt ? fmt : ""), (options ? ", " : ""), rss);
  				options |= RSS;
  				break;
***************
*** 427,431 ****
  		case 'z':					/* VSZ */
  			if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) {
! 				asprintf (&fmt, _("%s%sVSZ >= %d"), fmt, (options ? ", " : ""), vsz);
  				options |= VSZ;
  				break;
--- 427,431 ----
  		case 'z':					/* VSZ */
  			if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) {
! 				asprintf (&fmt, _("%s%sVSZ >= %d"), (fmt ? fmt : ""), (options ? ", " : ""), vsz);
  				options |= VSZ;
  				break;
***************
*** 438,442 ****
  			/* TODO: -P 1.5.5 is accepted */
  			if (sscanf (optarg, "%f%[^0-9.]", &pcpu, tmp) == 1) {
! 				asprintf (&fmt, _("%s%sPCPU >= %.2f"), fmt, (options ? ", " : ""), pcpu);
  				options |= PCPU;
  				break;
--- 438,442 ----
  			/* TODO: -P 1.5.5 is accepted */
  			if (sscanf (optarg, "%f%[^0-9.]", &pcpu, tmp) == 1) {
! 				asprintf (&fmt, _("%s%sPCPU >= %.2f"), (fmt ? fmt : ""), (options ? ", " : ""), pcpu);
  				options |= PCPU;
  				break;
***************
*** 481,485 ****
  	if (statopts == NULL && argv[c]) {
  		asprintf (&statopts, "%s", argv[c++]);
! 		asprintf (&fmt, _("%s%sSTATE = %s"), fmt, (options ? ", " : ""), statopts);
  		options |= STAT;
  	}
--- 481,485 ----
  	if (statopts == NULL && argv[c]) {
  		asprintf (&statopts, "%s", argv[c++]);
! 		asprintf (&fmt, _("%s%sSTATE = %s"), (fmt ? fmt : ""), (options ? ", " : ""), statopts);
  		options |= STAT;
  	}





More information about the Commits mailing list