Skip to content

Commit 66d4cc2

Browse files
shiltiantstellar
authored andcommitted
[OpenMP] Fix the wrong use of fopen
This patch fixes the wrong use of `fopen`. Fix #60934 Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D144601 (cherry picked from commit 22cd105)
1 parent 7ceeae3 commit 66d4cc2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

openmp/runtime/src/kmp_runtime.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "kmp_wait_release.h"
2525
#include "kmp_wrapper_getpid.h"
2626
#include "kmp_dispatch.h"
27-
#include <cstdio>
2827
#if KMP_USE_HIER_SCHED
2928
#include "kmp_dispatch_hier.h"
3029
#endif
@@ -6917,12 +6916,11 @@ void __kmp_unregister_library(void) {
69176916
// File did not open. Try the temporary file.
69186917
use_shm = false;
69196918
KMP_DEBUG_ASSERT(temp_reg_status_file_name);
6920-
FILE *tf = fopen(temp_reg_status_file_name, O_RDONLY);
6921-
if (!tf) {
6919+
fd1 = open(temp_reg_status_file_name, O_RDONLY);
6920+
if (fd1 == -1) {
69226921
// give it up now.
69236922
return;
69246923
}
6925-
fd1 = fileno(tf);
69266924
}
69276925
char *data1 = (char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
69286926
if (data1 != MAP_FAILED) {

0 commit comments

Comments
 (0)