diff options
author | Damien Miller <djm@mindrot.org> | 2008-12-09 14:11:49 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2008-12-09 14:11:49 +1100 |
commit | 1be2cc44961177897c3380ed7a8ec3641d5fd8ad (patch) | |
tree | f84f0fd66651dc2433749313bb78dddb1d66ddcc /sftp.c | |
parent | 586b00532f89e6166e6a74bdf3e801cc59449b84 (diff) |
- 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@
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp.c,v 1.103 2008/07/13 22:16:03 djm Exp $ */ | 1 | /* $OpenBSD: sftp.c,v 1.104 2008/12/09 02:39:59 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -1386,17 +1386,19 @@ parse_dispatch_command(struct sftp_conn *conn, const char *cmd, char **pwd, | |||
1386 | remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g); | 1386 | remote_glob(conn, path1, GLOB_NOCHECK, NULL, &g); |
1387 | for (i = 0; g.gl_pathv[i] && !interrupted; i++) { | 1387 | for (i = 0; g.gl_pathv[i] && !interrupted; i++) { |
1388 | if (!(aa = do_stat(conn, g.gl_pathv[i], 0))) { | 1388 | if (!(aa = do_stat(conn, g.gl_pathv[i], 0))) { |
1389 | if (err != 0 && err_abort) | 1389 | if (err_abort) { |
1390 | err = -1; | ||
1390 | break; | 1391 | break; |
1391 | else | 1392 | } else |
1392 | continue; | 1393 | continue; |
1393 | } | 1394 | } |
1394 | if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) { | 1395 | if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) { |
1395 | error("Can't get current ownership of " | 1396 | error("Can't get current ownership of " |
1396 | "remote file \"%s\"", g.gl_pathv[i]); | 1397 | "remote file \"%s\"", g.gl_pathv[i]); |
1397 | if (err != 0 && err_abort) | 1398 | if (err_abort) { |
1399 | err = -1; | ||
1398 | break; | 1400 | break; |
1399 | else | 1401 | } else |
1400 | continue; | 1402 | continue; |
1401 | } | 1403 | } |
1402 | aa->flags &= SSH2_FILEXFER_ATTR_UIDGID; | 1404 | aa->flags &= SSH2_FILEXFER_ATTR_UIDGID; |