Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1377560

Summary: Compiler warning: unused variable 'i' [-Wunused-variable]
Product: Red Hat Enterprise Linux 7 Reporter: ChunYu Wang <chunwang>
Component: rpcbindAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: ChunYu Wang <chunwang>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.3CC: eguan, steved, yoyang
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rpcbind-0.2.0-39.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 18:36:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 4 ChunYu Wang 2017-02-27 08:19:15 UTC
If we just delete this declaration of 'i', the other 'i' instances in for loops will get error with undeclared variable 'i', maybe it is better to change i = 0 into int i = 0 in each loop, this will both avoid the original unused 'i' problem and comply to C99 standard.
 
[chunwang@fs-qe src]$ cat ./rpcb_svc_com.c  |egrep SVC_RUN_DEBUG -A 5
#ifdef SVC_RUN_DEBUG
	int i;
#endif
	register struct pollfd	*p;
	fd_set cleanfds;

--
#ifdef SVC_RUN_DEBUG
		if (debugging) {
			fprintf(stderr, "polling for read on fd < ");
			for (i = 0, p = pollfds; i < nfds; i++, p++)
				if (p->events)
					fprintf(stderr, "%d ", p->fd);
--
#ifdef SVC_RUN_DEBUG
			if (debugging) {
				fprintf(stderr, "poll returned read fds < ");
				for (i = 0, p = pollfds; i < nfds; i++, p++)
					if (p->revents)
						fprintf(stderr, "%d ", p->fd);
--
<--snip-->
[chunwang@fs-qe rpcbind]$ cat ./rpcbind-0.2.0-i-warn.patch
diff -up rpcbind-0.2.0/src/rpcb_svc_com.c.orig rpcbind-0.2.0/src/rpcb_svc_com.c
--- rpcbind-0.2.0/src/rpcb_svc_com.c.orig	2017-02-25 14:47:09.839325988 -0500
+++ rpcbind-0.2.0/src/rpcb_svc_com.c	2017-02-25 14:47:57.424187563 -0500
@@ -1106,9 +1106,6 @@ my_svc_run()
 	struct pollfd pollfds[FD_SETSIZE];
 	int poll_ret, check_ret;
 	int n;
-#ifdef SVC_RUN_DEBUG
-	int i;
-#endif
 	register struct pollfd	*p;
 	fd_set cleanfds;

Comment 5 Steve Dickson 2017-02-27 23:09:02 UTC
(In reply to ChunYu Wang from comment #4)
> If we just delete this declaration of 'i', the other 'i' instances in for
> loops will get error with undeclared variable 'i', maybe it is better to
> change i = 0 into int i = 0 in each loop, this will both avoid the original
> unused 'i' problem and comply to C99 standard.
No. If that was true there would not have been a warning.
Plus those other SVC_RUN_DEBUG are in different routine.

Comment 7 ChunYu Wang 2017-03-13 03:24:57 UTC
Moved to VERIFIED according to Comment 6, will keep an eye on related issues in future erratas.

Comment 8 errata-xmlrpc 2017-08-01 18:36:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1992