]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: minimize scope of 'p'
authorLennart Poettering <lennart@poettering.net>
Wed, 6 Mar 2019 18:21:48 +0000 (19:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Mar 2019 16:38:43 +0000 (17:38 +0100)
src/systemctl/systemctl.c

index 7814d8313c957eb6863318ad8acb0e7993fc6848..03dea764cc6e5a858b46a3824f5c2b4d787e720b 100644 (file)
@@ -7983,7 +7983,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                 {}
         };
 
-        const char *p;
         int c, r;
 
         assert(argc >= 0);
@@ -8003,6 +8002,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         return version();
 
                 case 't': {
+                        const char *p;
+
                         if (isempty(optarg))
                                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                        "--type= requires arguments.");
@@ -8054,7 +8055,9 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                                 arg_properties = new0(char*, 1);
                                 if (!arg_properties)
                                         return log_oom();
-                        } else
+                        } else {
+                                const char *p;
+
                                 for (p = optarg;;) {
                                         _cleanup_free_ char *prop = NULL;
 
@@ -8069,6 +8072,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
 
                                         prop = NULL;
                                 }
+                        }
 
                         /* If the user asked for a particular
                          * property, show it to him, even if it is
@@ -8273,6 +8277,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         break;
 
                 case ARG_STATE: {
+                        const char *p;
+
                         if (isempty(optarg))
                                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                        "--state= requires arguments.");