diff options
Diffstat (limited to 'crypto/openssh/sftp-glob.c')
-rw-r--r-- | crypto/openssh/sftp-glob.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/crypto/openssh/sftp-glob.c b/crypto/openssh/sftp-glob.c index 1234074..ee122a2 100644 --- a/crypto/openssh/sftp-glob.c +++ b/crypto/openssh/sftp-glob.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sftp-glob.c,v 1.10 2002/02/13 00:59:23 djm Exp $"); +RCSID("$OpenBSD: sftp-glob.c,v 1.13 2002/09/11 22:41:50 djm Exp $"); #include "buffer.h" #include "bufaux.h" @@ -51,12 +51,14 @@ fudge_opendir(const char *path) r = xmalloc(sizeof(*r)); - if (do_readdir(cur.conn, (char*)path, &r->dir)) + if (do_readdir(cur.conn, (char *)path, &r->dir)) { + xfree(r); return(NULL); + } r->offset = 0; - return((void*)r); + return((void *)r); } static struct dirent * @@ -105,31 +107,12 @@ fudge_closedir(struct SFTP_OPENDIR *od) xfree(od); } -static void -attrib_to_stat(Attrib *a, struct stat *st) -{ - memset(st, 0, sizeof(*st)); - - if (a->flags & SSH2_FILEXFER_ATTR_SIZE) - st->st_size = a->size; - if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { - st->st_uid = a->uid; - st->st_gid = a->gid; - } - if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) - st->st_mode = a->perm; - if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { - st->st_atime = a->atime; - st->st_mtime = a->mtime; - } -} - static int fudge_lstat(const char *path, struct stat *st) { Attrib *a; - if (!(a = do_lstat(cur.conn, (char*)path, 0))) + if (!(a = do_lstat(cur.conn, (char *)path, 0))) return(-1); attrib_to_stat(a, st); @@ -142,7 +125,7 @@ fudge_stat(const char *path, struct stat *st) { Attrib *a; - if (!(a = do_stat(cur.conn, (char*)path, 0))) + if (!(a = do_stat(cur.conn, (char *)path, 0))) return(-1); attrib_to_stat(a, st); |