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:
pfg 2015-02-07 19:51:34 +00:00
parent 3e318877fe
commit 9ad953310c
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;
}