| 21766 | } |
| 21767 | |
| 21768 | static bool idxfailclosed_self_path(char out[CBM_SZ_4K]) { |
| 21769 | #ifdef __APPLE__ |
| 21770 | int length = proc_pidpath(getpid(), out, CBM_SZ_4K); |
| 21771 | bool resolved = length > 0 && length < CBM_SZ_4K; |
| 21772 | if (resolved) { |
| 21773 | out[length] = '\0'; |
| 21774 | } |
| 21775 | return resolved; |
| 21776 | #elif defined(__linux__) |
| 21777 | ssize_t length = readlink("/proc/self/exe", out, CBM_SZ_4K - 1); |
| 21778 | bool resolved = length > 0 && length < (ssize_t)CBM_SZ_4K - 1; |
| 21779 | if (resolved) { |
| 21780 | out[length] = '\0'; |
| 21781 | } |
| 21782 | return resolved; |
| 21783 | #else |
| 21784 | (void)out; |
| 21785 | return false; |
| 21786 | #endif |
| 21787 | } |
| 21788 | #endif |
| 21789 | |
| 21790 | TEST(index_supervisor_start_failure_is_fail_closed_in_real_host) { |