mirror of
https://git.openafs.org/openafs.git
synced 2025-02-01 05:57:43 +00:00
libadmin: Fix isAlias may be uninitialized warning
The cfgutil_HostNameIsAlias() function has an output parameter called isAlias, which is used when cfgutil_HostIsAlias() returns non-zero. However, it possible for isAlias to not be set before returning. GCC 12 issues a warning about the possible use of the uninitialized isAlias variable: cfginternal.c:366:32: error: ‘isAlias’ may be used uninitialized [-Werror=maybe-uninitialized] Initialize the cfgutil_HostNameIsAlias() isAlias output flag to false. Also, fix the misleading code indentation around the cfgutil_HostNameIsAlias() call. Change-Id: I68e66ae5f9019a613187321bb792d0505959ed30 Reviewed-on: https://gerrit.openafs.org/14772 Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
parent
9d42150b7b
commit
4a8d0c4089
@ -348,7 +348,7 @@ cfgutil_HostNameGetCellServDbAlias(const char *fsDbHost, const char *hostName,
|
||||
short dbhostFound = 0;
|
||||
|
||||
while (!dbhostDone) {
|
||||
short isAlias;
|
||||
short isAlias = 0;
|
||||
|
||||
if (!bos_HostGetNext(dbIter, hostNameAlias, &tst2)) {
|
||||
/* no more entries (or failure) */
|
||||
@ -357,15 +357,15 @@ cfgutil_HostNameGetCellServDbAlias(const char *fsDbHost, const char *hostName,
|
||||
}
|
||||
dbhostDone = 1;
|
||||
|
||||
} else
|
||||
if (!cfgutil_HostNameIsAlias
|
||||
(hostName, hostNameAlias, &isAlias, &tst2)) {
|
||||
tst = tst2;
|
||||
dbhostDone = 1;
|
||||
|
||||
} else if (isAlias) {
|
||||
dbhostFound = 1;
|
||||
dbhostDone = 1;
|
||||
} else {
|
||||
if (!cfgutil_HostNameIsAlias(hostName, hostNameAlias,
|
||||
&isAlias, &tst2)) {
|
||||
tst = tst2;
|
||||
dbhostDone = 1;
|
||||
} else if (isAlias) {
|
||||
dbhostFound = 1;
|
||||
dbhostDone = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user