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
This commit is contained in:
parent
1da5934b86
commit
f6a59a22b0
|
@ -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>
|
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
||||||
*
|
*
|
||||||
|
@ -669,7 +669,7 @@ do_lsreaddir(struct sftp_conn *conn, const char *path, int print_flag,
|
||||||
**dir = NULL;
|
**dir = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status == SSH2_FX_OK ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1019,7 +1019,7 @@ do_fsync(struct sftp_conn *conn, u_char *handle, u_int handle_len)
|
||||||
if (status != SSH2_FX_OK)
|
if (status != SSH2_FX_OK)
|
||||||
error("Couldn't sync file: %s", fx2txt(status));
|
error("Couldn't sync file: %s", fx2txt(status));
|
||||||
|
|
||||||
return status;
|
return status == SSH2_FX_OK ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
|
@ -1451,7 +1451,7 @@ do_download(struct sftp_conn *conn, const char *remote_path,
|
||||||
sshbuf_free(msg);
|
sshbuf_free(msg);
|
||||||
free(handle);
|
free(handle);
|
||||||
|
|
||||||
return(status);
|
return status == SSH2_FX_OK ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue