|
|
990e34 |
From f5fd689e40322a7b08a97eb2d26f192610728230 Mon Sep 17 00:00:00 2001
|
|
|
990e34 |
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
|
990e34 |
Date: Tue, 18 Jan 2022 16:10:28 +0100
|
|
|
990e34 |
Subject: [PATCH 170/174] tests/linkat: reset errno before SELinux context
|
|
|
990e34 |
manipulation
|
|
|
990e34 |
|
|
|
990e34 |
To avoid printing a stale error information in case of mismatch check
|
|
|
990e34 |
failure.
|
|
|
990e34 |
|
|
|
990e34 |
* tests/linkat.c: Include <errno.h>.
|
|
|
990e34 |
(main): Add "errno = 0" before update_secontext_field calls.
|
|
|
990e34 |
---
|
|
|
990e34 |
tests/linkat.c | 4 ++++
|
|
|
990e34 |
1 file changed, 4 insertions(+)
|
|
|
990e34 |
|
|
|
990e34 |
diff --git a/tests/linkat.c b/tests/linkat.c
|
|
|
990e34 |
index 1a869e3..c3e2ee4 100644
|
|
|
990e34 |
--- a/tests/linkat.c
|
|
|
990e34 |
+++ b/tests/linkat.c
|
|
|
990e34 |
@@ -10,6 +10,7 @@
|
|
|
990e34 |
#include "tests.h"
|
|
|
990e34 |
#include "scno.h"
|
|
|
990e34 |
|
|
|
990e34 |
+#include <errno.h>
|
|
|
990e34 |
#include <fcntl.h>
|
|
|
990e34 |
#include <stdio.h>
|
|
|
990e34 |
#include <stdlib.h>
|
|
|
990e34 |
@@ -91,6 +92,7 @@ main(void)
|
|
|
990e34 |
free(sample_1_secontext);
|
|
|
990e34 |
|
|
|
990e34 |
#ifdef PRINT_SECONTEXT_MISMATCH
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(sample_1, SECONTEXT_USER, "system_u");
|
|
|
990e34 |
sample_1_secontext = SECONTEXT_FILE(sample_1);
|
|
|
990e34 |
|
|
|
990e34 |
@@ -112,6 +114,7 @@ main(void)
|
|
|
990e34 |
free(sample_1_secontext);
|
|
|
990e34 |
#endif
|
|
|
990e34 |
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(sample_1, SECONTEXT_TYPE, "default_t");
|
|
|
990e34 |
sample_1_secontext = SECONTEXT_FILE(sample_1);
|
|
|
990e34 |
sample_2_secontext = sample_1_secontext;
|
|
|
990e34 |
@@ -142,6 +145,7 @@ main(void)
|
|
|
990e34 |
int dfd_old = get_dir_fd(".");
|
|
|
990e34 |
char *cwd = get_fd_path(dfd_old);
|
|
|
990e34 |
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(".", SECONTEXT_TYPE, "default_t");
|
|
|
990e34 |
char *dfd_old_secontext = SECONTEXT_FILE(".");
|
|
|
990e34 |
|
|
|
990e34 |
--- a/tests-m32/linkat.c
|
|
|
990e34 |
+++ b/tests-m32/linkat.c
|
|
|
990e34 |
@@ -10,6 +10,7 @@
|
|
|
990e34 |
#include "tests.h"
|
|
|
990e34 |
#include "scno.h"
|
|
|
990e34 |
|
|
|
990e34 |
+#include <errno.h>
|
|
|
990e34 |
#include <fcntl.h>
|
|
|
990e34 |
#include <stdio.h>
|
|
|
990e34 |
#include <stdlib.h>
|
|
|
990e34 |
@@ -91,6 +92,7 @@ main(void)
|
|
|
990e34 |
free(sample_1_secontext);
|
|
|
990e34 |
|
|
|
990e34 |
#ifdef PRINT_SECONTEXT_MISMATCH
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(sample_1, SECONTEXT_USER, "system_u");
|
|
|
990e34 |
sample_1_secontext = SECONTEXT_FILE(sample_1);
|
|
|
990e34 |
|
|
|
990e34 |
@@ -112,6 +114,7 @@ main(void)
|
|
|
990e34 |
free(sample_1_secontext);
|
|
|
990e34 |
#endif
|
|
|
990e34 |
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(sample_1, SECONTEXT_TYPE, "default_t");
|
|
|
990e34 |
sample_1_secontext = SECONTEXT_FILE(sample_1);
|
|
|
990e34 |
sample_2_secontext = sample_1_secontext;
|
|
|
990e34 |
@@ -142,6 +145,7 @@ main(void)
|
|
|
990e34 |
int dfd_old = get_dir_fd(".");
|
|
|
990e34 |
char *cwd = get_fd_path(dfd_old);
|
|
|
990e34 |
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(".", SECONTEXT_TYPE, "default_t");
|
|
|
990e34 |
char *dfd_old_secontext = SECONTEXT_FILE(".");
|
|
|
990e34 |
|
|
|
990e34 |
--- a/tests-mx32/linkat.c
|
|
|
990e34 |
+++ b/tests-mx32/linkat.c
|
|
|
990e34 |
@@ -10,6 +10,7 @@
|
|
|
990e34 |
#include "tests.h"
|
|
|
990e34 |
#include "scno.h"
|
|
|
990e34 |
|
|
|
990e34 |
+#include <errno.h>
|
|
|
990e34 |
#include <fcntl.h>
|
|
|
990e34 |
#include <stdio.h>
|
|
|
990e34 |
#include <stdlib.h>
|
|
|
990e34 |
@@ -91,6 +92,7 @@ main(void)
|
|
|
990e34 |
free(sample_1_secontext);
|
|
|
990e34 |
|
|
|
990e34 |
#ifdef PRINT_SECONTEXT_MISMATCH
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(sample_1, SECONTEXT_USER, "system_u");
|
|
|
990e34 |
sample_1_secontext = SECONTEXT_FILE(sample_1);
|
|
|
990e34 |
|
|
|
990e34 |
@@ -112,6 +114,7 @@ main(void)
|
|
|
990e34 |
free(sample_1_secontext);
|
|
|
990e34 |
#endif
|
|
|
990e34 |
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(sample_1, SECONTEXT_TYPE, "default_t");
|
|
|
990e34 |
sample_1_secontext = SECONTEXT_FILE(sample_1);
|
|
|
990e34 |
sample_2_secontext = sample_1_secontext;
|
|
|
990e34 |
@@ -142,6 +145,7 @@ main(void)
|
|
|
990e34 |
int dfd_old = get_dir_fd(".");
|
|
|
990e34 |
char *cwd = get_fd_path(dfd_old);
|
|
|
990e34 |
|
|
|
990e34 |
+ errno = 0;
|
|
|
990e34 |
update_secontext_field(".", SECONTEXT_TYPE, "default_t");
|
|
|
990e34 |
char *dfd_old_secontext = SECONTEXT_FILE(".");
|
|
|
990e34 |
|
|
|
990e34 |
--
|
|
|
990e34 |
2.1.4
|
|
|
990e34 |
|