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:
parent
87786342a5
commit
284ef21ea0
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user