661545
From 2d1a6a5665492cc0a71554045b2293e1193c889b Mon Sep 17 00:00:00 2001
661545
From: Frantisek Sumsal <fsumsal@redhat.com>
661545
Date: Wed, 27 Feb 2019 19:51:48 +0100
661545
Subject: [PATCH] machinectl: check correct FD for a return value
661545
661545
Found by LGTM.
661545
661545
Resolves: #1694605
661545
---
661545
 src/machine/machinectl.c | 2 +-
661545
 1 file changed, 1 insertion(+), 1 deletion(-)
661545
661545
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
661545
index 1a58aeaf11..66b64e1feb 100644
661545
--- a/src/machine/machinectl.c
661545
+++ b/src/machine/machinectl.c
661545
@@ -1086,7 +1086,7 @@ static int copy_files(int argc, char *argv[], void *userdata) {
661545
                 return r;
661545
 
661545
         hostfd = open(host_dirname, O_CLOEXEC|O_RDONLY|O_NOCTTY|O_DIRECTORY);
661545
-        if (r < 0)
661545
+        if (hostfd < 0)
661545
                 return log_error_errno(errno, "Failed to open source directory: %m");
661545
 
661545
         child = fork();