Fix track_process with PIDs over 32767 (#1770766)

This commit is contained in:
Ryan O'Hara 2019-11-12 04:44:42 -06:00
parent 876ddb0e6e
commit c453f7e249
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 23a5b8113bf0b8ec4718443df0406882e8e4d831 Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Sat, 9 Nov 2019 10:07:48 +0000
Subject: [PATCH] Fix track_process with PIDs > 32767
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
---
keepalived/core/track_process.c | 4 ++--
lib/scheduler.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/keepalived/core/track_process.c b/keepalived/core/track_process.c
index 550254b1..76ff6009 100644
--- a/keepalived/core/track_process.c
+++ b/keepalived/core/track_process.c
@@ -341,7 +341,7 @@ check_process(pid_t pid, char *comm, tracked_process_instance_t *tpi)
* swapped in to read it. */
if (!have_comm) {
if (vrrp_data->vrrp_use_process_cmdline) {
- snprintf(cmdline, sizeof(cmdline), "/proc/%hd/cmdline", pid);
+ snprintf(cmdline, sizeof(cmdline), "/proc/%d/cmdline", pid);
if ((fd = open(cmdline, O_RDONLY)) == -1)
return;
@@ -358,7 +358,7 @@ check_process(pid_t pid, char *comm, tracked_process_instance_t *tpi)
}
if (vrrp_data->vrrp_use_process_comm) {
- snprintf(cmdline, sizeof(cmdline), "/proc/%hd/comm", pid);
+ snprintf(cmdline, sizeof(cmdline), "/proc/%d/comm", pid);
fd = open(cmdline, O_RDONLY);
if (fd == -1) {
diff --git a/lib/scheduler.c b/lib/scheduler.c
index 3cd7b65a..de92c7d4 100644
--- a/lib/scheduler.c
+++ b/lib/scheduler.c
@@ -441,7 +441,7 @@ report_child_status(int status, pid_t pid, char const *prog_name)
prog_id = child_finder_name(pid);
if (!prog_id) {
- snprintf(pid_buf, sizeof(pid_buf), "pid %hd", pid);
+ snprintf(pid_buf, sizeof(pid_buf), "pid %d", pid);
prog_id = pid_buf;
}
--
2.23.0

View File

@ -10,13 +10,15 @@
Name: keepalived
Summary: High Availability monitor built upon LVS, VRRP and service pollers
Version: 2.0.19
Release: 1%{?dist}
Release: 3%{?dist}
License: GPLv2+
URL: http://www.keepalived.org/
Source0: http://www.keepalived.org/software/keepalived-%{version}.tar.gz
Source1: keepalived.service
Patch0: keepalived-fix-track_process-with-pids-32767.patch
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
@ -51,6 +53,7 @@ infrastructures.
%prep
%setup -q
%patch0 -p1
%build
%configure \
@ -100,6 +103,9 @@ mkdir -p %{buildroot}%{_libexecdir}/keepalived
%{_mandir}/man8/keepalived.8*
%changelog
* Tue Nov 12 2019 Ryan O'Hara <rohara@redhat.com> - 2.0.19-3
- Fix track_process with PIDs over 32767 (#1770766)
* Wed Nov 06 2019 Ryan O'Hara <rohara@redhat.com> - 2.0.19-2
- Enable nftables support (#1769278)