From 6fade5a075d9958bdb100478a8e56ba70e1ae8d7a2d7ba347f92a012c88e405f Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dmueller@suse.com>
Date: Fri, 30 Sep 2022 20:50:33 +0000
Subject: [PATCH] - add include-fixes.patch - reenable FORTIFY_SOURCE=3

OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxcfs?expand=0&rev=43
---
 include-fixes.patch | 13 +++++++++++++
 lxcfs.changes       |  6 ++++++
 lxcfs.spec          |  4 ++--
 3 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100644 include-fixes.patch

diff --git a/include-fixes.patch b/include-fixes.patch
new file mode 100644
index 0000000..9c82977
--- /dev/null
+++ b/include-fixes.patch
@@ -0,0 +1,13 @@
+Index: lxcfs-4.0.12/src/utils.h
+===================================================================
+--- lxcfs-4.0.12.orig/src/utils.h
++++ lxcfs-4.0.12/src/utils.h
+@@ -46,6 +46,8 @@ static inline int pidfd_open(pid_t pid,
+ {
+ 	return syscall(__NR_pidfd_open, pid, flags);
+ }
++#else
++#include <sys/pidfd.h>
+ #endif
+ 
+ #if !HAVE_PIDFD_SEND_SIGNAL
diff --git a/lxcfs.changes b/lxcfs.changes
index 734d890..056a97a 100644
--- a/lxcfs.changes
+++ b/lxcfs.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Fri Sep 30 20:50:08 UTC 2022 - Dirk Müller <dmueller@suse.com>
+
+- add include-fixes.patch
+- reenable FORTIFY_SOURCE=3 
+
 -------------------------------------------------------------------
 Sun Sep 25 17:00:54 UTC 2022 - Johannes Kastl <kastl@b1-systems.de>
 
diff --git a/lxcfs.spec b/lxcfs.spec
index 7cf1168..99f3b19 100644
--- a/lxcfs.spec
+++ b/lxcfs.spec
@@ -31,6 +31,7 @@ URL:            https://linuxcontainers.org/lxcfs
 Source:         https://linuxcontainers.org/downloads/%{name}/%{name}-%{version}.tar.gz
 Source1:        https://linuxcontainers.org/downloads/%{name}/%{name}-%{version}.tar.gz.asc
 Source2:        %{name}.keyring
+Patch1:         include-fixes.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  fdupes
@@ -63,11 +64,10 @@ Configuration to add hooks for %{name} so that it automatically interoperates
 with LXC for all containers.
 
 %prep
-%setup
+%autosetup -p1
 
 %build
 autoreconf -vif
-export CPPFLAGS="-D_FORTIFY_SOURCE=2"
 %configure --with-distro=opensuse
 make %{?_smp_mflags}