diff options
author | Colin Watson <cjwatson@debian.org> | 2003-09-01 02:05:26 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2003-09-01 02:05:26 +0000 |
commit | 6d5a72bc1d98a42ba42f082e50a22e911c1d82d3 (patch) | |
tree | 1bf23174bdb6fc71e2846dda0eca195a418484e7 /sftp-glob.c | |
parent | 2ee26b431f98cf1dc0e4fb9809ad1e0c879b8c08 (diff) | |
parent | 58657d96514cd6f16d82add8d6f4adbb36765758 (diff) |
Debian release 3.5p1-1.
Diffstat (limited to 'sftp-glob.c')
-rw-r--r-- | sftp-glob.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/sftp-glob.c b/sftp-glob.c index 1234074c4..ee122a2cd 100644 --- a/sftp-glob.c +++ b/sftp-glob.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: sftp-glob.c,v 1.10 2002/02/13 00:59:23 djm Exp $"); | 26 | RCSID("$OpenBSD: sftp-glob.c,v 1.13 2002/09/11 22:41:50 djm Exp $"); |
27 | 27 | ||
28 | #include "buffer.h" | 28 | #include "buffer.h" |
29 | #include "bufaux.h" | 29 | #include "bufaux.h" |
@@ -51,12 +51,14 @@ fudge_opendir(const char *path) | |||
51 | 51 | ||
52 | r = xmalloc(sizeof(*r)); | 52 | r = xmalloc(sizeof(*r)); |
53 | 53 | ||
54 | if (do_readdir(cur.conn, (char*)path, &r->dir)) | 54 | if (do_readdir(cur.conn, (char *)path, &r->dir)) { |
55 | xfree(r); | ||
55 | return(NULL); | 56 | return(NULL); |
57 | } | ||
56 | 58 | ||
57 | r->offset = 0; | 59 | r->offset = 0; |
58 | 60 | ||
59 | return((void*)r); | 61 | return((void *)r); |
60 | } | 62 | } |
61 | 63 | ||
62 | static struct dirent * | 64 | static struct dirent * |
@@ -105,31 +107,12 @@ fudge_closedir(struct SFTP_OPENDIR *od) | |||
105 | xfree(od); | 107 | xfree(od); |
106 | } | 108 | } |
107 | 109 | ||
108 | static void | ||
109 | attrib_to_stat(Attrib *a, struct stat *st) | ||
110 | { | ||
111 | memset(st, 0, sizeof(*st)); | ||
112 | |||
113 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) | ||
114 | st->st_size = a->size; | ||
115 | if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { | ||
116 | st->st_uid = a->uid; | ||
117 | st->st_gid = a->gid; | ||
118 | } | ||
119 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) | ||
120 | st->st_mode = a->perm; | ||
121 | if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { | ||
122 | st->st_atime = a->atime; | ||
123 | st->st_mtime = a->mtime; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | static int | 110 | static int |
128 | fudge_lstat(const char *path, struct stat *st) | 111 | fudge_lstat(const char *path, struct stat *st) |
129 | { | 112 | { |
130 | Attrib *a; | 113 | Attrib *a; |
131 | 114 | ||
132 | if (!(a = do_lstat(cur.conn, (char*)path, 0))) | 115 | if (!(a = do_lstat(cur.conn, (char *)path, 0))) |
133 | return(-1); | 116 | return(-1); |
134 | 117 | ||
135 | attrib_to_stat(a, st); | 118 | attrib_to_stat(a, st); |
@@ -142,7 +125,7 @@ fudge_stat(const char *path, struct stat *st) | |||
142 | { | 125 | { |
143 | Attrib *a; | 126 | Attrib *a; |
144 | 127 | ||
145 | if (!(a = do_stat(cur.conn, (char*)path, 0))) | 128 | if (!(a = do_stat(cur.conn, (char *)path, 0))) |
146 | return(-1); | 129 | return(-1); |
147 | 130 | ||
148 | attrib_to_stat(a, st); | 131 | attrib_to_stat(a, st); |