[PATCH 2/2] standard_file: Reverse return code logic for remote exists

Simon Marchi <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
The local "exists" case:

  return [file exists $file]

returns 1 when the file exists, 0 otherwise.  The remote case does the
opposite, because it returns the process return code directly, where 0
is true/success/exists and non-zero is false/fail/does not exist.  This
patch fixes the remote case by reversing the logic.

ChangeLog:

	* lib/remote.exp (standard_file): Reverse return logic for
	remote exists case.
---
 lib/remote.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/remote.exp b/lib/remote.exp
index 688680b..359cf31 100644
--- a/lib/remote.exp
+++ b/lib/remote.exp
@@ -766,7 +766,7 @@ proc standard_file { dest op args } {
 	switch $op {
 	    exists {
 		set status [remote_exec $dest "test -f $file"]
-		return [lindex $status 0]
+		return [expr [lindex $status 0] == 0]
 	    }
 	    delete {
 		set file ""
-- 
2.5.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.