diff options
Diffstat (limited to 'sftp-client.c')
-rw-r--r-- | sftp-client.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/sftp-client.c b/sftp-client.c index ffff0fe5a..81c5dd497 100644 --- a/sftp-client.c +++ b/sftp-client.c | |||
@@ -1,25 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2001-2003 Damien Miller. All rights reserved. | 2 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Permission to use, copy, modify, and distribute this software for any |
5 | * modification, are permitted provided that the following conditions | 5 | * purpose with or without fee is hereby granted, provided that the above |
6 | * are met: | 6 | * copyright notice and this permission notice appear in all copies. |
7 | * 1. Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * 2. Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * | 7 | * |
13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
15 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
16 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
18 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
19 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
20 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
23 | */ | 15 | */ |
24 | 16 | ||
25 | /* XXX: memleaks */ | 17 | /* XXX: memleaks */ |
@@ -28,7 +20,7 @@ | |||
28 | /* XXX: copy between two remote sites */ | 20 | /* XXX: copy between two remote sites */ |
29 | 21 | ||
30 | #include "includes.h" | 22 | #include "includes.h" |
31 | RCSID("$OpenBSD: sftp-client.c,v 1.44 2003/06/28 16:23:06 deraadt Exp $"); | 23 | RCSID("$OpenBSD: sftp-client.c,v 1.46 2004/02/17 05:39:51 djm Exp $"); |
32 | 24 | ||
33 | #include "openbsd-compat/sys-queue.h" | 25 | #include "openbsd-compat/sys-queue.h" |
34 | 26 | ||
@@ -798,7 +790,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path, | |||
798 | return(-1); | 790 | return(-1); |
799 | } | 791 | } |
800 | 792 | ||
801 | local_fd = open(local_path, O_WRONLY | O_CREAT | O_TRUNC, | 793 | local_fd = open(local_path, O_WRONLY | O_CREAT | O_TRUNC, |
802 | mode | S_IWRITE); | 794 | mode | S_IWRITE); |
803 | if (local_fd == -1) { | 795 | if (local_fd == -1) { |
804 | error("Couldn't open local file \"%s\" for writing: %s", | 796 | error("Couldn't open local file \"%s\" for writing: %s", |
@@ -946,7 +938,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path, | |||
946 | /* Override umask and utimes if asked */ | 938 | /* Override umask and utimes if asked */ |
947 | #ifdef HAVE_FCHMOD | 939 | #ifdef HAVE_FCHMOD |
948 | if (pflag && fchmod(local_fd, mode) == -1) | 940 | if (pflag && fchmod(local_fd, mode) == -1) |
949 | #else | 941 | #else |
950 | if (pflag && chmod(local_path, mode) == -1) | 942 | if (pflag && chmod(local_path, mode) == -1) |
951 | #endif /* HAVE_FCHMOD */ | 943 | #endif /* HAVE_FCHMOD */ |
952 | error("Couldn't set mode on \"%s\": %s", local_path, | 944 | error("Couldn't set mode on \"%s\": %s", local_path, |