From ddb5e00fafa753af7bd671e6633ba352b8b2bee2 Mon Sep 17 00:00:00 2001 From: djm Date: Tue, 9 Dec 2008 03:11:49 +0000 Subject: [PATCH] - djm@cvs.openbsd.org 2008/12/09 02:39:59 [sftp.c] 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@ --- ChangeLog | 5 +++++ sftp.c | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8bc5e9a4..f5dab202 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,11 @@ that requested it. Disable it on slave sessions until such time as it is fixed; bz#1543 report from Adrian Bridgett via Colin Watson ok markus@ + - djm@cvs.openbsd.org 2008/12/09 02:39:59 + [sftp.c] + 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@ 20081208 - (djm) [configure.ac] bz#1538: better test for ProPolice/SSP: actually diff --git a/sftp.c b/sftp.c index e1aa49d0..4e3c833f 100644 --- a/sftp.c +++ b/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 * @@ -1386,17 +1386,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; -- 2.45.2