Skip to content

Commit 398b733

Browse files
kolyshkinpcmoore
authored andcommitted
all: simplify version checks
As the code errors out earlier if seccomp version is less than 2.2.0, there is no need to check for SCMP_VER_MAJOR < 2. Drop it. Signed-off-by: Kir Kolyshkin <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 4a0a385 commit 398b733

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

seccomp_internal.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ const uint32_t C_ACT_NOTIFY = SCMP_ACT_NOTIFY;
116116
117117
// The libseccomp SCMP_FLTATR_CTL_LOG member of the scmp_filter_attr enum was
118118
// added in v2.4.0
119-
#if (SCMP_VER_MAJOR < 2) || \
120-
(SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 4)
119+
#if SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 4
121120
#define SCMP_FLTATR_CTL_LOG _SCMP_FLTATR_MIN
122121
#endif
123122
#if SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 5
@@ -176,8 +175,7 @@ unsigned int get_micro_version()
176175
#endif
177176
178177
// The libseccomp API level functions were added in v2.4.0
179-
#if (SCMP_VER_MAJOR < 2) || \
180-
(SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 4)
178+
#if SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 4
181179
const unsigned int seccomp_api_get(void)
182180
{
183181
// libseccomp-golang requires libseccomp v2.2.0, at a minimum, which
@@ -220,8 +218,7 @@ void add_struct_arg_cmp(
220218
}
221219
222220
// The seccomp notify API functions were added in v2.5.0
223-
#if (SCMP_VER_MAJOR < 2) || \
224-
(SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 5)
221+
#if SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR < 5
225222
226223
struct seccomp_data {
227224
int nr;

0 commit comments

Comments
 (0)