diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2018-05-25 04:25:47 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2018-05-25 04:25:47 +0000 |
commit | 33e511d9c5b6415da06508a687bb82dc652cb78d (patch) | |
tree | 1da261c196bb8f3b2c867a2373c8a8ec128311f8 | |
parent | 20a37425c706ad5962f08e67f428923f5e24e94b (diff) |
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.c | 8 |
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 |