int get_relocated_file(int fd, const char *name, char** newname, int *errorcode) { int found_file = 0; int use_cache = (opts & OPT_SHMCACHE) && (shm_cachesize > 0); char cache_name[MAX_PATH_LEN+1]; if (use_cache) { debug_printf2("Looking up %s in shared cache\n", name); get_cache_name(name, "", cache_name); cache_name[sizeof(cache_name)-1] = '\0'; found_file = fetch_from_cache(cache_name, newname); } if (!found_file) { debug_printf2("Send file request to server: %s\n", name); send_file_query(fd, (char *) name, newname, errorcode); debug_printf2("Recv file from server: %s\n", *newname ? *newname : "NONE"); if (use_cache) shmcache_update(cache_name, *newname); } return 0; }
static int find_exec(const char *filepath, char **argv, char *newpath, int newpath_size, char ***new_argv) { char *newname = NULL; if (!filepath) { newpath[0] = '\0'; return 0; } check_for_fork(); if (ldcsid < 0 || !use_ldcs || exec_filter(filepath) != REDIRECT) { strncpy(newpath, filepath, newpath_size); newpath[newpath_size-1] = '\0'; return 0; } sync_cwd(); debug_printf2("Exec operation requesting file: %s\n", filepath); send_file_query(ldcsid, (char *) filepath, &newname); debug_printf("Exec file request returned %s -> %s\n", filepath, newname ? newname : "NULL"); return prep_exec(filepath, argv, newname, newpath, newpath_size, new_argv); }