summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sftp.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-12-09 02:40:00 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-12-09 02:40:00 +0000
commit78408990e0d958c99acb1a1c500513ff31e730a6 (patch)
treeeef78aeef554d2462a960a5de1be4b14c7794f2f /usr.bin/ssh/sftp.c
parentba3b4ecf507662f680dc7d6739c87fa33bca488c (diff)
Deal correctly with failures in remote stat() operation in sftp,
correcting fail-on-error behaviour in batchmode. bz#1541 report and fix from anedvedicky AT gmail.com; ok markus@
Diffstat (limited to 'usr.bin/ssh/sftp.c')
-rw-r--r--usr.bin/ssh/sftp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index a0b9bc399f1..6c8e814f501 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.103 2008/07/13 22:16:03 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.104 2008/12/09 02:39:59 djm Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -1365,17 +1365,19 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd,
remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g);
for (i = 0; g.gl_pathv[i] && !interrupted; i++) {
if (!(aa = do_stat(conn, g.gl_pathv[i], 0))) {
- if (err != 0 && err_abort)
+ if (err_abort) {
+ err = -1;
break;
- else
+ } else
continue;
}
if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) {
error("Can't get current ownership of "
"remote file \"%s\"", g.gl_pathv[i]);
- if (err != 0 && err_abort)
+ if (err_abort) {
+ err = -1;
break;
- else
+ } else
continue;
}
aa->flags &= SSH2_FILEXFER_ATTR_UIDGID;