static bool TwinExists(void) { char twinfilename[CF_BUFSIZE]; struct stat sb; snprintf(twinfilename, CF_BUFSIZE, "%s/%s", CFWORKDIR, TwinFilename()); MapName(twinfilename); return (stat(twinfilename, &sb) == 0) && (IsExecutable(twinfilename)); }
/* Buffer has to be at least CF_BUFSIZE bytes long */ static void ConstructFailsafeCommand(bool scheduled_run, char *buffer) { bool twin_exists = TwinExists(); snprintf(buffer, CF_BUFSIZE, "\"%s/%s\" -f failsafe.cf " "&& \"%s/%s\" -Dfrom_cfexecd%s", CFWORKDIR, twin_exists ? TwinFilename() : AgentFilename(), CFWORKDIR, AgentFilename(), scheduled_run ? ":scheduled_run" : ""); }
/* Buffer has to be at least CF_BUFSIZE bytes long */ static void ConstructFailsafeCommand(bool scheduled_run, char *buffer) { bool twin_exists = TwinExists(); const char* const workdir = GetWorkDir(); snprintf(buffer, CF_BUFSIZE, "\"%s%c%s\" -f failsafe.cf " "&& \"%s%c%s\" -Dfrom_cfexecd%s", workdir, FILE_SEPARATOR, twin_exists ? TwinFilename() : AgentFilename(), workdir, FILE_SEPARATOR, AgentFilename(), scheduled_run ? ",scheduled_run" : ""); }