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