]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
vmspawn: do not use r for loop count
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 Mar 2025 16:35:13 +0000 (01:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 Mar 2025 16:47:48 +0000 (01:47 +0900)
In a future, we may call some functions and r may be used for storing
error code of them. Let's not use r for the maximum number of loop count.

src/vmspawn/vmspawn.c

index 849dd617dc3ac8d8993a28954488784677ad4a0e..d616f2c7ab8828c7c29d7fa7f8c6478bc19a4635 100644 (file)
@@ -2513,11 +2513,11 @@ static int run(int argc, char *argv[]) {
                                  glyph(GLYPH_LIGHT_SHADE), ansi_grey(), ansi_highlight(), ansi_grey(), ansi_normal());
         }
 
-        r = sd_listen_fds_with_names(true, &names);
-        if (r < 0)
-                return log_error_errno(r, "Failed to get passed file descriptors: %m");
+        int n = sd_listen_fds_with_names(true, &names);
+        if (n < 0)
+                return log_error_errno(n, "Failed to get passed file descriptors: %m");
 
-        for (int i = 0; i < r; i++) {
+        for (int i = 0; i < n; i++) {
                 int fd = SD_LISTEN_FDS_START + i;
                 if (streq(names[i], "kvm"))
                         kvm_device_fd = fd;