OSDN Git Service
(root)
/
android-x86
/
external-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
18b8cfa
)
bpf: close the file descriptor after probe inside getHostCPUNameForBPF
author
Yonghong Song
<yhs@fb.com>
Wed, 23 Aug 2017 16:24:31 +0000
(16:24 +0000)
committer
Yonghong Song
<yhs@fb.com>
Wed, 23 Aug 2017 16:24:31 +0000
(16:24 +0000)
Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311567
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Support/Host.cpp
patch
|
blob
|
history
diff --git
a/lib/Support/Host.cpp
b/lib/Support/Host.cpp
index
aa1c4ae
..
ad16b02
100644
(file)
--- a/
lib/Support/Host.cpp
+++ b/
lib/Support/Host.cpp
@@
-300,7
+300,11
@@
StringRef sys::detail::getHostCPUNameForBPF() {
attr.license = (uint64_t)"DUMMY";
int fd = syscall(321 /* __NR_bpf */, 5 /* BPF_PROG_LOAD */, &attr, sizeof(attr));
- return (fd > 0) ? "v2" : "v1";
+ if (fd >= 0) {
+ close(fd);
+ return "v2";
+ }
+ return "v1";
#endif
}