Check for failures from getpagesize(3)

Return errno on failure, similar to the open(2) call above it.

MFC after:	5 weeks
Reported by:	Coverity
CID:		1193753
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Enji Cooper 2017-04-23 01:47:51 +00:00
parent ae0cf296c9
commit 2cebfa7bbf

View File

@ -87,6 +87,8 @@ geom_stats_open(void)
if (statsfd < 0)
return (errno);
pagesize = getpagesize();
if (pagesize == -1)
return (errno);
spp = pagesize / sizeof(struct devstat);
p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED) {