If only opening only other of the files fails, the successfully opened
file was not closed. This scenario is extremely unlikely, but should
be fixed never the less.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
int ret;
kpageflags_fd = open("/proc/kpageflags", O_RDONLY);
- kpagecount_fd = open("/proc/kpagecount", O_RDONLY);
+ if (kpageflags_fd < 0)
+ return -1;
- if (kpageflags_fd == -1 || kpagecount_fd == -1)
+ kpagecount_fd = open("/proc/kpagecount", O_RDONLY);
+ if (kpagecount_fd < 0)
return -1;
pf = rb_to_pageframe(rb_first(root));