MCPcopy Create free account
hub / github.com/apache/cloudberry / find_other_exec

Function find_other_exec

src/common/exec.c:326–356  ·  view source on GitHub ↗

* Find another program in our binary's directory, * then make sure it is the proper version. */

Source from the content-addressed store, hash-verified

324 * then make sure it is the proper version.
325 */
326int
327find_other_exec(const char *argv0, const char *target,
328 const char *versionstr, char *retpath)
329{
330 char cmd[MAXPGPATH];
331 char line[MAXPGPATH];
332
333 if (find_my_exec(argv0, retpath) < 0)
334 return -1;
335
336 /* Trim off program name and keep just directory */
337 *last_dir_separator(retpath) = '\0';
338 canonicalize_path(retpath);
339
340 /* Now append the other program's name */
341 snprintf(retpath + strlen(retpath), MAXPGPATH - strlen(retpath),
342 "/%s%s", target, EXE);
343
344 if (validate_exec(retpath) != 0)
345 return -1;
346
347 snprintf(cmd, sizeof(cmd), "\"%s\" -V", retpath);
348
349 if (!pipe_read_line(cmd, line, sizeof(line)))
350 return -1;
351
352 if (strcmp(line, versionstr) != 0)
353 return -2;
354
355 return 0;
356}
357
358
359/*

Callers 11

getInstallationPathsFunction · 0.85
isolation_start_testFunction · 0.85
find_helper_programsFunction · 0.85
get_target_dbidFunction · 0.85
getRestoreCommandFunction · 0.85
ensureCleanShutdownFunction · 0.85
mainFunction · 0.85
setup_bin_pathsFunction · 0.85
mainFunction · 0.85
find_other_exec_or_dieFunction · 0.85
pgwin32_CommandLineFunction · 0.85

Calls 5

find_my_execFunction · 0.85
last_dir_separatorFunction · 0.85
canonicalize_pathFunction · 0.85
validate_execFunction · 0.85
pipe_read_lineFunction · 0.85

Tested by 2

isolation_start_testFunction · 0.68
find_helper_programsFunction · 0.68