Fix running the client and server tests
This commit is contained in:
parent
bcd92341dd
commit
c4c7e84ddc
46
libssh-0.9.4-torture_fix_pid_range_check.patch
Normal file
46
libssh-0.9.4-torture_fix_pid_range_check.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From b33dcda94d313913a877bc8db006ad02141bc695 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Jelen <jjelen@redhat.com>
|
||||
Date: Wed, 11 Dec 2019 11:07:33 +0100
|
||||
Subject: [PATCH] torture: Accept whole pid_t range
|
||||
|
||||
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
|
||||
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
||||
(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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user