OpenPAM

Check-in [f91967f73b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Compare the return value from mmap() to MAP_FAILED, not NULL.
Timelines: family | ancestors | descendants | both | trunk | svn-rev-823
Files: files | file ages | folders
SHA1: f91967f73bb78ebd3cd2951c9ae4bd20b518b77f
User & Date: des 2014-10-16 13:44:34
Context
2014-10-18
22:35
Remove unused variable. check-in: 96303d7417 user: des tags: trunk, svn-rev-824
2014-10-16
13:44
Compare the return value from mmap() to MAP_FAILED, not NULL. check-in: f91967f73b user: des tags: trunk, svn-rev-823
2014-10-09
14:45
Avoid double-quoting function-like macros. check-in: dfdd990da0 user: des tags: trunk, svn-rev-821
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/liboath/oath_key_alloc.c.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
	int prot, flags;

	prot = PROT_READ|PROT_WRITE;
	flags = MAP_ANON;
#ifdef MAP_NOCORE
	flags |= MAP_NOCORE;
#endif
	if ((key = mmap(NULL, sizeof *key, prot, flags, -1, 0)) != NULL) {
		memset(key, 0, sizeof *key);
		key->mapped = 1;
		if (mlock(key, sizeof *key) == 0)
			key->locked = 1;
	} else {
		openpam_log(PAM_LOG_ERROR, "mmap(): %m");
		if ((key = calloc(sizeof *key, 1)) == NULL)







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
	int prot, flags;

	prot = PROT_READ|PROT_WRITE;
	flags = MAP_ANON;
#ifdef MAP_NOCORE
	flags |= MAP_NOCORE;
#endif
	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)
			key->locked = 1;
	} else {
		openpam_log(PAM_LOG_ERROR, "mmap(): %m");
		if ((key = calloc(sizeof *key, 1)) == NULL)