From 1d544ba38373096575207fceef815e11dc0bc985 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 1 Apr 2008 16:52:43 +0000
Subject: [PATCH] Check whether path is valid before accessing it

Reviewed-by: ultrotter
---
 lib/ssh.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/ssh.py b/lib/ssh.py
index 2b06a585f..6f32e5683 100644
--- a/lib/ssh.py
+++ b/lib/ssh.py
@@ -163,14 +163,14 @@ class SshRunner:
       success: True/False
 
     """
-    if not os.path.isfile(filename):
-      logger.Error("file %s does not exist" % (filename))
-      return False
-
     if not os.path.isabs(filename):
       logger.Error("file %s must be an absolute path" % (filename))
       return False
 
+    if not os.path.isfile(filename):
+      logger.Error("file %s does not exist" % (filename))
+      return False
+
     command = [constants.SCP, "-q", "-p"]
     command.extend(KNOWN_HOSTS_OPTS)
     command.extend(BATCH_MODE_OPTS)
-- 
GitLab