]> andersk Git - openssh.git/blobdiff - sftp-server.c
- markus@cvs.openbsd.org 2002/01/25 22:07:40
[openssh.git] / sftp-server.c
index 5f1b37b014658a1051ce58629d274be19d05fdab..6d6658614d9c1f29aa315658ade7e656f2159a30 100644 (file)
@@ -22,7 +22,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "includes.h"
-RCSID("$OpenBSD: sftp-server.c,v 1.29 2001/06/25 08:25:40 markus Exp $");
+RCSID("$OpenBSD: sftp-server.c,v 1.32 2001/12/29 21:56:01 stevesk Exp $");
 
 #include "buffer.h"
 #include "bufaux.h"
@@ -144,7 +144,7 @@ handle_init(void)
 {
        int i;
 
-       for(i = 0; i < sizeof(handles)/sizeof(Handle); i++)
+       for (i = 0; i < sizeof(handles)/sizeof(Handle); i++)
                handles[i].use = HANDLE_UNUSED;
 }
 
@@ -153,7 +153,7 @@ handle_new(int use, char *name, int fd, DIR *dirp)
 {
        int i;
 
-       for(i = 0; i < sizeof(handles)/sizeof(Handle); i++) {
+       for (i = 0; i < sizeof(handles)/sizeof(Handle); i++) {
                if (handles[i].use == HANDLE_UNUSED) {
                        handles[i].use = use;
                        handles[i].dirp = dirp;
@@ -756,8 +756,8 @@ process_readdir(void)
                                stats = xrealloc(stats, nstats * sizeof(Stat));
                        }
 /* XXX OVERFLOW ? */
-                       snprintf(pathname, sizeof pathname,
-                           "%s/%s", path, dp->d_name);
+                       snprintf(pathname, sizeof pathname, "%s%s%s", path,
+                           strcmp(path, "/") ? "/" : "", dp->d_name);
                        if (lstat(pathname, &st) < 0)
                                continue;
                        stat_to_attrib(&st, &(stats[count].attrib));
@@ -771,7 +771,7 @@ process_readdir(void)
                }
                if (count > 0) {
                        send_names(id, count, stats);
-                       for(i = 0; i < count; i++) {
+                       for (i = 0; i < count; i++) {
                                xfree(stats[i].name);
                                xfree(stats[i].long_name);
                        }
@@ -897,7 +897,7 @@ process_readlink(void)
                send_status(id, errno_to_portable(errno));
        else {
                Stat s;
-               
+
                link[len] = '\0';
                attrib_clear(&s.attrib);
                s.name = s.long_name = link;
@@ -951,7 +951,7 @@ process(void)
 
        if (buffer_len(&iqueue) < 5)
                return;         /* Incomplete message. */
-       cp = (u_char *) buffer_ptr(&iqueue);
+       cp = buffer_ptr(&iqueue);
        msg_len = GET_32BIT(cp);
        if (msg_len > 256 * 1024) {
                error("bad message ");
This page took 0.373237 seconds and 4 git commands to generate.