* Resolves the executable path from argv[0], only if it is absolute. * * Returns 0 on success, -1 on failure. */
| 68 | * Returns 0 on success, -1 on failure. |
| 69 | */ |
| 70 | static int git_get_exec_path_from_argv0(struct strbuf *buf, const char *argv0) |
| 71 | { |
| 72 | const char *slash; |
| 73 | |
| 74 | if (!argv0 || !*argv0) |
| 75 | return -1; |
| 76 | |
| 77 | slash = find_last_dir_sep(argv0); |
| 78 | if (slash) { |
| 79 | trace_printf("trace: resolved executable path from argv0: %s\n", |
| 80 | argv0); |
| 81 | strbuf_add_absolute_path(buf, argv0); |
| 82 | return 0; |
| 83 | } |
| 84 | return -1; |
| 85 | } |
| 86 | |
| 87 | #ifdef PROCFS_EXECUTABLE_PATH |
| 88 | /* |
no test coverage detected