Unverified Commit 284ef21e authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fix fd check in memtest_test_linux_anonymous_maps (#12943)

The open function returns a fd on success or -1 on failure,
here we should check fd != -1, otherwise -1 will be judged
as success.

This closes #12938.
parent 87786342
...@@ -2076,7 +2076,7 @@ int memtest_test_linux_anonymous_maps(void) { ...@@ -2076,7 +2076,7 @@ int memtest_test_linux_anonymous_maps(void) {
int regions = 0, j; int regions = 0, j;
int fd = openDirectLogFiledes(); int fd = openDirectLogFiledes();
if (!fd) return 0; if (fd == -1) return 0;
fp = fopen("/proc/self/maps","r"); fp = fopen("/proc/self/maps","r");
if (!fp) { if (!fp) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment