From db01fe2426d8b5a2cfe5b5de8798931d7dc77b11 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 11 Dec 2019 11:41:28 +0100 Subject: [PATCH] Fix running the client and server tests --- ...sh-0.9.4-torture_fix_pid_range_check.patch | 46 +++++++++++++++++++ libssh.spec | 2 + 2 files changed, 48 insertions(+) create mode 100644 libssh-0.9.4-torture_fix_pid_range_check.patch diff --git a/libssh-0.9.4-torture_fix_pid_range_check.patch b/libssh-0.9.4-torture_fix_pid_range_check.patch new file mode 100644 index 0000000..17e10fe --- /dev/null +++ b/libssh-0.9.4-torture_fix_pid_range_check.patch @@ -0,0 +1,46 @@ +From b33dcda94d313913a877bc8db006ad02141bc695 Mon Sep 17 00:00:00 2001 +From: Jakub Jelen +Date: Wed, 11 Dec 2019 11:07:33 +0100 +Subject: [PATCH] torture: Accept whole pid_t range + +Signed-off-by: Jakub Jelen +Reviewed-by: Andreas Schneider +(cherry picked from commit d2a32ca6d3c40483a6d10340d3e11da9259e1379) +--- + tests/torture.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/tests/torture.c b/tests/torture.c +index 360fd02a..907f45b3 100644 +--- a/tests/torture.c ++++ b/tests/torture.c +@@ -196,6 +196,7 @@ torture_read_pidfile(const char *pidfile) + { + char buf[8] = {0}; + long int tmp; ++ pid_t ret; + ssize_t rc; + int fd; + +@@ -213,11 +214,16 @@ torture_read_pidfile(const char *pidfile) + buf[sizeof(buf) - 1] = '\0'; + + tmp = strtol(buf, NULL, 10); +- if (tmp == 0 || tmp > 0xFFFF || errno == ERANGE) { ++ if (tmp == 0 || errno == ERANGE) { ++ return -1; ++ } ++ ret = (pid_t)tmp; ++ /* Check if we are out of pid_t range on this system */ ++ if ((long)ret != tmp) { + return -1; + } + +- return (pid_t)(tmp & 0xFFFF); ++ return ret; + } + + int torture_terminate_process(const char *pidfile) +-- +2.23.0 + diff --git a/libssh.spec b/libssh.spec index 06b3d01..6ee4ba2 100644 --- a/libssh.spec +++ b/libssh.spec @@ -11,6 +11,8 @@ Source2: https://cryptomilk.org/gpgkey-8DFF53E18F2ABC8D8F3C92237EE0FC4DCC Source3: libssh_client.config Source4: libssh_server.config +Patch0: libssh-0.9.4-torture_fix_pid_range_check.patch + BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: gnupg2