daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
b8c242
From fdfff847313222eed3306ac605db46d8cbd23212 Mon Sep 17 00:00:00 2001
b8c242
From: Frantisek Sumsal <frantisek@sumsal.cz>
b8c242
Date: Mon, 29 Nov 2021 13:47:24 +0100
b8c242
Subject: [PATCH] test,systemctl: use "const char*" instead of "char*"
b8c242
b8c242
as iterator for FOREACH_STRING()
b8c242
b8c242
The macro iterates through literal strings (i.e. constant strings),
b8c242
hence it's more correct to have the iterator const too.
b8c242
b8c242
Based on b2238e380e5f2fbcc129643b3fbd66f2828fd57c.
b8c242
b8c242
Related: #2017033
b8c242
---
b8c242
 src/systemctl/systemctl.c | 3 ++-
b8c242
 src/test/test-execute.c   | 2 +-
b8c242
 2 files changed, 3 insertions(+), 2 deletions(-)
b8c242
b8c242
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
b8c242
index 3dd7c1522f..b967550b97 100644
b8c242
--- a/src/systemctl/systemctl.c
b8c242
+++ b/src/systemctl/systemctl.c
b8c242
@@ -7011,7 +7011,8 @@ static int run_editor(char **paths) {
b8c242
         if (r == 0) {
b8c242
                 const char **args;
b8c242
                 char *editor, **editor_args = NULL;
b8c242
-                char **tmp_path, **original_path, *p;
b8c242
+                char **tmp_path, **original_path;
b8c242
+                const char *p;
b8c242
                 size_t n_editor_args = 0, i = 1;
b8c242
                 size_t argc;
b8c242
 
b8c242
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
b8c242
index 5303652b93..7581d5ed68 100644
b8c242
--- a/src/test/test-execute.c
b8c242
+++ b/src/test/test-execute.c
b8c242
@@ -146,7 +146,7 @@ invalid:
b8c242
 }
b8c242
 
b8c242
 static bool is_inaccessible_available(void) {
b8c242
-        char *p;
b8c242
+        const char *p;
b8c242
 
b8c242
         FOREACH_STRING(p,
b8c242
                 "/run/systemd/inaccessible/reg",