Compare the return value from mmap() to MAP_FAILED, not NULL.

git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@823 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2014-10-16 13:44:34 +00:00
parent 2c148271ae
commit ce08052f96
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ oath_key_alloc(void)
#ifdef MAP_NOCORE
flags |= MAP_NOCORE;
#endif
if ((key = mmap(NULL, sizeof *key, prot, flags, -1, 0)) != NULL) {
if ((key = mmap(NULL, sizeof *key, prot, flags, -1, 0)) != MAP_FAILED) {
memset(key, 0, sizeof *key);
key->mapped = 1;
if (mlock(key, sizeof *key) == 0)