diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 989efba021f1aac031f6a3d76e803321b1bf1ee2..49fd84b4a7481dc8f1390840fac4d27e36afd303 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,10 +43,10 @@ build:clang:linux:amd64: image: $CI_REGISTRY/knot/knot-resolver/ci/debian-unstable:knot-2.7 # newer Debian for newer Clang script: - rm daemon/lua/kres-gen.lua - - CXX=clang++-5.0 CC=clang-5.0 make -k all "CFLAGS=-Werror -Wno-error=unused-command-line-argument -ggdb" + - CXX=clang++ CC=clang make -k all "CFLAGS=-Werror -Wno-error=unused-command-line-argument -ggdb" - STATUS="$(git status --untracked-files=normal --porcelain)" - test -n "${STATUS}" && echo "${STATUS}" && echo "Build + install made working tree dirty, did you forget to update something?" && exit 2 - - CXX=clang++-5.0 CC=clang-5.0 make install "CFLAGS=-Werror -ggdb" + - CXX=clang++ CC=clang make install "CFLAGS=-Werror -ggdb" tags: - docker - linux @@ -87,7 +87,7 @@ lint:c: image: $CI_REGISTRY/knot/knot-resolver/ci/debian-unstable:knot-2.7 # newer Debian for newer Clang dependencies: [] # do not download build artifacts script: - - make lint-c CLANG_TIDY="clang-tidy-5.0 -quiet" + - make lint-c CLANG_TIDY="clang-tidy -quiet" tags: - docker @@ -99,7 +99,7 @@ lint:clang-scan-build: image: $CI_REGISTRY/knot/knot-resolver/ci/debian-unstable:knot-2.7 # newer Debian for newer Clang dependencies: [] # do not download build artifacts script: - - MAKEFLAGS="-k -j$(nproc)" SCAN_BUILD="/usr/lib/llvm-5.0/bin/scan-build -o scan-results --status-bugs -no-failure-reports" ./tests/clang_scan_build.sh make + - MAKEFLAGS="-k -j$(nproc)" SCAN_BUILD="scan-build -o scan-results --status-bugs -no-failure-reports" ./tests/clang_scan_build.sh make artifacts: when: on_failure expire_in: '1 day' diff --git a/ci/debian-unstable/Dockerfile b/ci/debian-unstable/Dockerfile index 0f0658bdceaba424e10ec34a7bfa427096abcea9..19315d9b08c347a6fb5ee33eeaa227574c41142a 100644 --- a/ci/debian-unstable/Dockerfile +++ b/ci/debian-unstable/Dockerfile @@ -39,5 +39,5 @@ RUN luarocks install luacov # LuaJIT binary for stand-alone scripting RUN apt-get install -y -qqq luajit -# clang for kresd CI -RUN apt-get install -y -qqq clang-5.0 clang-tools-5.0 clang-tidy-5.0 +# clang for kresd CI, version updated as debian updates it +RUN apt-get install -y -qqq clang clang-tools clang-tidy diff --git a/daemon/main.c b/daemon/main.c index 7bced7bcae216e47d1f3e71091554efb8eed1b47..bbe10c6ec082c077b4dc9aed0f4c4c4962682ab9 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -513,6 +513,14 @@ static void args_init(struct args *args) args->quiet = false; } +static long strtol_10(const char *s) +{ + if (!s) abort(); + /* ^^ This shouldn't ever happen. When getopt_long() returns an option + * character that has a mandatory parameter, optarg can't be NULL. */ + return strtol(s, NULL, 10); +} + /** Process arguments into struct args. * @return >=0 if main() should be exited immediately. */ @@ -546,17 +554,17 @@ static int parse_args(int argc, char **argv, struct args *args) array_push(args->tls_set, optarg); break; case 'S': - array_push(args->fd_set, strtol(optarg, NULL, 10)); + array_push(args->fd_set, strtol_10(optarg)); break; case 'T': - array_push(args->tls_fd_set, strtol(optarg, NULL, 10)); + array_push(args->tls_fd_set, strtol_10(optarg)); break; case 'c': args->config = optarg; break; case 'f': args->interactive = false; - args->forks = strtol(optarg, NULL, 10); + args->forks = strtol_10(optarg); if (args->forks <= 0) { kr_log_error("[system] error '-f' requires a positive" " number, not '%s'\n", optarg);