From bac2bb8a428d0219f723bc90b39049264c7d1d58 Mon Sep 17 00:00:00 2001 From: Robikz Date: Mon, 12 Dec 2022 12:02:26 +0100 Subject: [PATCH 1/2] Fix a missing endl in scheduler's pick_server() --- scheduler/scheduler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scheduler/scheduler.cpp b/scheduler/scheduler.cpp index 61f19bb4..1da207c5 100644 --- a/scheduler/scheduler.cpp +++ b/scheduler/scheduler.cpp @@ -929,7 +929,8 @@ static CompileServer *pick_server(Job *job, SchedulerAlgorithmName schedulerAlgo << " load: " << selected->load() << " can install: " - << selected->can_install(job); + << selected->can_install(job) + << endl; return selected; } From b9fa653a20616403b088c74ea70d8e3a7dc309c4 Mon Sep 17 00:00:00 2001 From: Robikz Date: Tue, 13 Dec 2022 15:38:24 +0100 Subject: [PATCH 2/2] Minor/text fixes: trailing whitespace, indentation, typo --- client/argv.c | 12 ++++++------ client/client.h | 4 ++-- client/local.cpp | 4 ++-- daemon/main.cpp | 2 +- scheduler/scheduler.cpp | 2 +- services/comm.cpp | 2 +- services/comm.h | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/argv.c b/client/argv.c index e835828d..a1e9e1fa 100644 --- a/client/argv.c +++ b/client/argv.c @@ -69,10 +69,10 @@ dupargv (char * const *argv) { int argc; char **copy; - + if (argv == NULL) return NULL; - + /* the vector */ for (argc = 0; argv[argc] != NULL; argc++); copy = (char **) malloc ((argc + 1) * sizeof (char *)); @@ -392,11 +392,11 @@ expandargv (int *argcp, char ***argvp) /* Free the original options memory. */ free((*argvp)[i]); /* Now, insert FILE_ARGV into ARGV. The "+1" below handles the - NULL terminator at the end of ARGV. */ - *argvp = ((char **) - realloc (*argvp, + NULL terminator at the end of ARGV. */ + *argvp = ((char **) + realloc (*argvp, (*argcp + file_argc + 1) * sizeof (char *))); - memmove (*argvp + i + file_argc, *argvp + i + 1, + memmove (*argvp + i + file_argc, *argvp + i + 1, (*argcp - i) * sizeof (char *)); memcpy (*argvp + i, file_argv, file_argc * sizeof (char *)); /* The original option has been replaced by all the new diff --git a/client/client.h b/client/client.h index a3b05a8b..a791c5be 100644 --- a/client/client.h +++ b/client/client.h @@ -90,7 +90,7 @@ extern Environments parse_icecc_version(const std::string &target, const std::st class client_error : public std::runtime_error { public: - client_error(int code, const std::string& what) + client_error(int code, const std::string& what) : std::runtime_error(what) , errorCode(code) {} @@ -101,7 +101,7 @@ class client_error : public std::runtime_error class remote_error : public client_error { public: - remote_error(int code, const std::string& what) + remote_error(int code, const std::string& what) : client_error(code, what) {} }; diff --git a/client/local.cpp b/client/local.cpp index 2744b7d3..83338cdd 100644 --- a/client/local.cpp +++ b/client/local.cpp @@ -330,7 +330,7 @@ int build_local(CompileJob &job, MsgChannel *local_daemon, struct rusage *used) arguments.push_back(job.outputFile()); } - vector argv; + vector argv; string argstxt; for (list::const_iterator it = arguments.begin(); it != arguments.end(); ++it) { @@ -423,7 +423,7 @@ int build_local(CompileJob &job, MsgChannel *local_daemon, struct rusage *used) char buf[250]; for (;;) { - int r; + int r; while ((r = read(pf[0], buf, sizeof(buf) - 1)) > 0) { buf[r] = '\0'; s_ccout.append(buf); diff --git a/daemon/main.cpp b/daemon/main.cpp index ad3399fb..2b9082f3 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -673,7 +673,7 @@ bool Daemon::setup_listen_unix_fd() strncpy(myaddr.sun_path, default_socket.c_str() , sizeof(myaddr.sun_path) - 1); myaddr.sun_path[sizeof(myaddr.sun_path) - 1] = '\0'; if(default_socket.length() > sizeof(myaddr.sun_path) - 1) { - log_error() << "default socket path too long for sun_path" << endl; + log_error() << "default socket path too long for sun_path" << endl; } if (-1 == unlink(myaddr.sun_path) && errno != ENOENT){ log_perror("unlink failed") << "\t" << myaddr.sun_path << endl; diff --git a/scheduler/scheduler.cpp b/scheduler/scheduler.cpp index 1da207c5..45ec2820 100644 --- a/scheduler/scheduler.cpp +++ b/scheduler/scheduler.cpp @@ -664,7 +664,7 @@ static list filter_ineligible_servers(Job *job) trace() << cs->nodeName() << " fails remote job check\n"; return false; } - + return true; }); return eligible; diff --git a/services/comm.cpp b/services/comm.cpp index 97392db6..c43732d5 100644 --- a/services/comm.cpp +++ b/services/comm.cpp @@ -291,7 +291,7 @@ bool MsgChannel::update_state() } case HAS_MSG: - /* handled elsewere */ + /* handled elsewhere */ break; case ERROR: diff --git a/services/comm.h b/services/comm.h index 42d2b939..0727251d 100644 --- a/services/comm.h +++ b/services/comm.h @@ -396,10 +396,10 @@ class DiscoverSched } /* Attempt to get a conenction to the scheduler. - - Continue to call this while it returns NULL and timed_out() + + Continue to call this while it returns NULL and timed_out() returns false. If this returns NULL you should wait for either - more data on listen_fd() (use select), or a timeout of your own. + more data on listen_fd() (use select), or a timeout of your own. */ MsgChannel *try_get_scheduler();