summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sftp-client.c b/sftp-client.c
index 3fac22bee..8c12dae11 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -28,7 +28,7 @@
28/* XXX: copy between two remote sites */ 28/* XXX: copy between two remote sites */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: sftp-client.c,v 1.40 2003/01/10 08:48:15 djm Exp $"); 31RCSID("$OpenBSD: sftp-client.c,v 1.41 2003/01/14 10:58:00 djm Exp $");
32 32
33#include "openbsd-compat/sys-queue.h" 33#include "openbsd-compat/sys-queue.h"
34 34
@@ -767,8 +767,8 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
767 mode = 0666; 767 mode = 0666;
768 768
769 if ((a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) && 769 if ((a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) &&
770 (a->perm & S_IFDIR)) { 770 (!S_ISREG(a->perm))) {
771 error("Cannot download a directory: %s", remote_path); 771 error("Cannot download non-regular file: %s", remote_path);
772 return(-1); 772 return(-1);
773 } 773 }
774 774
@@ -1002,6 +1002,11 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path,
1002 close(local_fd); 1002 close(local_fd);
1003 return(-1); 1003 return(-1);
1004 } 1004 }
1005 if (!S_ISREG(sb.st_mode)) {
1006 error("%s is not a regular file", local_path);
1007 close(local_fd);
1008 return(-1);
1009 }
1005 stat_to_attrib(&sb, &a); 1010 stat_to_attrib(&sb, &a);
1006 1011
1007 a.flags &= ~SSH2_FILEXFER_ATTR_SIZE; 1012 a.flags &= ~SSH2_FILEXFER_ATTR_SIZE;