MCPcopy Index your code
hub / github.com/git/git / git_get_exec_path_bsd_sysctl

Function git_get_exec_path_bsd_sysctl

exec-cmd.c:111–129  ·  view source on GitHub ↗

* Resolves the executable path using KERN_PROC_PATHNAME BSD sysctl. * * Returns 0 on success, -1 on failure. */

Source from the content-addressed store, hash-verified

109 * Returns 0 on success, -1 on failure.
110 */
111static int git_get_exec_path_bsd_sysctl(struct strbuf *buf)
112{
113 int mib[4];
114 char path[MAXPATHLEN];
115 size_t cb = sizeof(path);
116
117 mib[0] = CTL_KERN;
118 mib[1] = KERN_PROC;
119 mib[2] = KERN_PROC_PATHNAME;
120 mib[3] = -1;
121 if (!sysctl(mib, 4, path, &cb, NULL, 0)) {
122 trace_printf(
123 "trace: resolved executable path from sysctl: %s\n",
124 path);
125 strbuf_addstr(buf, path);
126 return 0;
127 }
128 return -1;
129}
130#endif /* HAVE_BSD_KERN_PROC_SYSCTL */
131
132#ifdef HAVE_NS_GET_EXECUTABLE_PATH

Callers 1

exec-cmd.cFile · 0.85

Calls 1

strbuf_addstrFunction · 0.85

Tested by

no test coverage detected