buildroot/package/crun/0001-libcrun-fix-compile-er...

60 lines
1.8 KiB
Diff

From ea27b1363ef709ce4b169138017b67ef624b127b Mon Sep 17 00:00:00 2001
From: Xiangyu Chen <xiangyu.chen@windriver.com>
Date: Tue, 12 Dec 2023 10:47:42 +0800
Subject: [PATCH] libcrun: fix compile error without libseccomp and libcap
Fixed compile error without libseccomp and libcap, running
clang-format to format the code style.
Upstream: https://github.com/containers/crun/commit/ea27b1363ef709ce4b169138017b67ef624b127b
Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
---
src/libcrun/container.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/libcrun/container.c b/src/libcrun/container.c
index 34649f8..ffcdb24 100644
--- a/src/libcrun/container.c
+++ b/src/libcrun/container.c
@@ -23,7 +23,9 @@
#include "container.h"
#include "utils.h"
#include "seccomp.h"
-#include <seccomp.h>
+#ifdef HAVE_SECCOMP
+# include <seccomp.h>
+#endif
#include "scheduler.h"
#include "seccomp_notify.h"
#include "custom-handler.h"
@@ -47,7 +49,9 @@
#include <sys/signalfd.h>
#include <sys/epoll.h>
#include <sys/socket.h>
-#include <sys/capability.h>
+#ifdef HAVE_CAP
+# include <sys/capability.h>
+#endif
#include <sys/ioctl.h>
#include <termios.h>
#include <grp.h>
@@ -3829,6 +3833,7 @@ populate_array_field (char ***field, char *array[], size_t num_elements)
(*field)[i] = NULL;
}
+#ifdef HAVE_CAP
static void
populate_capabilities (struct features_info_s *info, char ***capabilities, size_t *num_capabilities)
{
@@ -3876,6 +3881,7 @@ populate_capabilities (struct features_info_s *info, char ***capabilities, size_
(*capabilities)[index] = NULL; // Terminate the array with NULL
populate_array_field (&(info->linux.capabilities), *capabilities, *num_capabilities);
}
+#endif
static void
retrieve_mount_options (struct features_info_s **info)
--
2.34.1