summaryrefslogtreecommitdiff
path: root/0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-06 02:26:06 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-06 02:26:06 +0000
commit5957157a0edfe9f07583bdb7530b172da2d7adfd (patch)
tree3bbe9ee8b02c4b84782d71167ed57549c008ce92 /0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch
parent568b42b6ea0df8c498b6d8583c24caf101a47dd8 (diff)
automatic import of libguestfsopeneuler24.03_LTS
Diffstat (limited to '0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch')
-rw-r--r--0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch b/0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch
new file mode 100644
index 0000000..569cd02
--- /dev/null
+++ b/0004-daemon-selinux-relabel-search-for-invalid-option-in-.patch
@@ -0,0 +1,33 @@
+From c1829048c598e11950c9d355fdd5c177a99e046f Mon Sep 17 00:00:00 2001
+From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
+Date: Wed, 26 Apr 2023 15:59:45 +0300
+Subject: [PATCH] daemon/selinux-relabel: search for "invalid option" in
+ setfiles output
+
+'X' in the setiles' stderr doesn't necessarily mean that option 'X'
+doesn't exist. For instance, when passing '-T' we get: "setfiles:
+option requires an argument -- 'T'".
+
+Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
+Reviewed-by: Laszlo Ersek <lersek@redhat.com>
+Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
+(cherry picked from commit 152d6e4bdf2dac88856a4ff83cf73451f897d4d4)
+---
+ daemon/selinux-relabel.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/daemon/selinux-relabel.c b/daemon/selinux-relabel.c
+index 454486c1..60a6f48a 100644
+--- a/daemon/selinux-relabel.c
++++ b/daemon/selinux-relabel.c
+@@ -56,8 +56,9 @@ setfiles_has_option (int *flag, char opt_char)
+
+ if (*flag == -1) {
+ char option[] = { '-', opt_char, '\0' }; /* "-X" */
+- char err_opt[] = { '\'', opt_char, '\'', '\0'}; /* "'X'" */
++ char err_opt[32]; /* "invalid option -- 'X'" */
+
++ snprintf(err_opt, sizeof(err_opt), "invalid option -- '%c'", opt_char);
+ ignore_value (command (NULL, &err, "setfiles", option, NULL));
+ *flag = err && strstr (err, /* "invalid option -- " */ err_opt) == NULL;
+ }