summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2018-05-25 04:25:46 +0000
committerdjm <djm@openbsd.org>2018-05-25 04:25:46 +0000
commitc38808a68c483727f980d9ac6d793fc0edf131fe (patch)
tree2cd94222d6832b6a3741a36178b86dbd68f9b33b
parentsync (diff)
downloadwireguard-openbsd-c38808a68c483727f980d9ac6d793fc0edf131fe.tar.xz
wireguard-openbsd-c38808a68c483727f980d9ac6d793fc0edf131fe.zip
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
-rw-r--r--usr.bin/ssh/sftp-client.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c
index 2f3e68eb196..d66eb486f3e 100644
--- a/usr.bin/ssh/sftp-client.c
+++ b/usr.bin/ssh/sftp-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-client.c,v 1.128 2017/11/28 21:10:22 dtucker Exp $ */
+/* $OpenBSD: sftp-client.c,v 1.129 2018/05/25 04:25:46 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -655,7 +655,7 @@ do_lsreaddir(struct sftp_conn *conn, const char *path, int print_flag,
**dir = NULL;
}
- return status;
+ return status == SSH2_FX_OK ? 0 : -1;
}
int
@@ -1005,7 +1005,7 @@ do_fsync(struct sftp_conn *conn, u_char *handle, u_int handle_len)
if (status != SSH2_FX_OK)
error("Couldn't sync file: %s", fx2txt(status));
- return status;
+ return status == SSH2_FX_OK ? 0 : -1;
}
#ifdef notyet
@@ -1433,7 +1433,7 @@ do_download(struct sftp_conn *conn, const char *remote_path,
sshbuf_free(msg);
free(handle);
- return(status);
+ return status == SSH2_FX_OK ? 0 : -1;
}
static int