File openssh-7.6p1-sftp-client-return-code.patch of Package openssh.17572
From f6a59a22b0c157c4c4e5fd7232f868138223be64 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Fri, 25 May 2018 04:25:46 +0000
Subject: [PATCH] upstream: Fix return value confusion in several functions
(readdir,
download and fsync). These should return -1 on error, not a sftp status code.
patch from Petr Cerny in bz#2871
OpenBSD-Commit-ID: 651aa0220ad23c9167d9297a436162d741f97a09
---
sftp-client.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: openssh-7.6p1/sftp-client.c
===================================================================
--- openssh-7.6p1.orig/sftp-client.c 2019-03-12 14:33:57.139372883 +0100
+++ openssh-7.6p1/sftp-client.c 2019-03-12 14:38:37.396942324 +0100
@@ -659,7 +659,7 @@ do_lsreaddir(struct sftp_conn *conn, con
**dir = NULL;
}
- return status;
+ return status == SSH2_FX_OK ? 0 : -1;
}
int
@@ -1009,7 +1009,7 @@ do_fsync(struct sftp_conn *conn, u_char
if (status != SSH2_FX_OK)
error("Couldn't sync file: %s", fx2txt(status));
- return status;
+ return status == SSH2_FX_OK ? 0 : -1;
}
#ifdef notyet
@@ -1441,7 +1441,7 @@ do_download(struct sftp_conn *conn, cons
sshbuf_free(msg);
free(handle);
- return(status);
+ return status == SSH2_FX_OK ? 0 : -1;
}
static int