]> andersk Git - gssapi-openssh.git/blobdiff - openssh/sftp-glob.c
o Merge changes from OPENSSH_3_5P1_GSI_20021018.
[gssapi-openssh.git] / openssh / sftp-glob.c
index 1234074c45ccc0d3f076cb0f5452517a2eef8d63..ee122a2cd586f98cace72156ba42843edff92307 100644 (file)
@@ -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);
This page took 0.034492 seconds and 4 git commands to generate.