Skip to content

Commit 867e458

Browse files
committed
Fix compile error on ohos
OpenHarmony's libc doesn't have get_current_dir_name(), So guard get_current_dir_name() related dfsw and dfso methods with #ifndef __OHOS__.
1 parent 62cd050 commit 867e458

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler-rt/lib/dfsan/dfsan_custom.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,8 @@ char *__dfso_getcwd(char *buf, size_t size, dfsan_label buf_label,
10771077
return ret;
10781078
}
10791079

1080+
#ifndef __OHOS__
1081+
// OpenHarmonyOS doesn't have get_current_dir_name()
10801082
SANITIZER_INTERFACE_ATTRIBUTE
10811083
char *__dfsw_get_current_dir_name(dfsan_label *ret_label) {
10821084
char *ret = get_current_dir_name();
@@ -1091,6 +1093,7 @@ char *__dfso_get_current_dir_name(dfsan_label *ret_label,
10911093
dfsan_origin *ret_origin) {
10921094
return __dfsw_get_current_dir_name(ret_label);
10931095
}
1096+
#endif // __OHOS__
10941097

10951098
// This function is only available for glibc 2.25 or newer. Mark it weak so
10961099
// linking succeeds with older glibcs.

0 commit comments

Comments
 (0)