ryantimwilson / rpms / systemd

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