Message ID | 9615e42e-4783-4170-8702-042df4ce8d58@BAMAIL02.ba.imgtec.org |
---|---|
State | New |
Headers | show |
On Wed, 10 Dec 2014, Steve Ellcey wrote: > I looked at the code and I don't think we can actually use an uninitialized > fct variable (due to the use of the no_more variable) but the compiler doesn't > seem to be able to figure that out. This fix is to just initialize fct to > NULL. As previously discussed, we don't want to add such initializations to quiet warnings. In this case, it looks like moving the while loop inside the "if (! no_more)" ought to make it obvious to the compiler that fct can't be used uninitialized.
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c index e101537..4dc8eef 100644 --- a/inet/getnetgrent_r.c +++ b/inet/getnetgrent_r.c @@ -268,7 +268,7 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp, struct __netgrent *datap, char *buffer, size_t buflen, int *errnop) { - enum nss_status (*fct) (struct __netgrent *, char *, size_t, int *); + enum nss_status (*fct) (struct __netgrent *, char *, size_t, int *) = NULL; /* Initialize status to return if no more functions are found. */ enum nss_status status = NSS_STATUS_NOTFOUND;