Protect uninitialized scalar variable from being accessed

In a couple of cases a variable "stayopen" can be checked
unitialized. This is of no danger as the complementary
condition is false but prevent the access by switching
the checks.

CID:	1018729
CID:	1018732
This commit is contained in:
Pedro F. Giffuni 2015-02-07 19:51:34 +00:00
parent d5a6319ac7
commit eb77fbdcec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=278363
2 changed files with 2 additions and 2 deletions

View File

@ -896,7 +896,7 @@ files_group(void *retval, void *mdata, va_list ap)
break;
pos = ftello(st->fp);
}
if (!stayopen && st->fp != NULL) {
if (st->fp != NULL && !stayopen) {
fclose(st->fp);
st->fp = NULL;
}

View File

@ -921,7 +921,7 @@ files_passwd(void *retval, void *mdata, va_list ap)
errnop);
} while (how == nss_lt_all && !(rv & NS_TERMINATE));
fin:
if (!stayopen && st->db != NULL) {
if (st->db != NULL && !stayopen) {
(void)st->db->close(st->db);
st->db = NULL;
}