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.
This commit is contained in:
Binbin 2024-01-14 17:18:17 +08:00 committed by GitHub
parent 87786342a5
commit 284ef21ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -2076,7 +2076,7 @@ int memtest_test_linux_anonymous_maps(void) {
int regions = 0, j;
int fd = openDirectLogFiledes();
if (!fd) return 0;
if (fd == -1) return 0;
fp = fopen("/proc/self/maps","r");
if (!fp) {