return . and .. first in readdir - this fixes masktest on IRIX which
authorHerb Lewis <herb@samba.org>
Thu, 21 Mar 2002 14:00:13 +0000 (14:00 +0000)
committerHerb Lewis <herb@samba.org>
Thu, 21 Mar 2002 14:00:13 +0000 (14:00 +0000)
returns . then single letter files then .. then all other files.
(This used to be commit d4d9361eec11f50c780ed4c79bc9775ac24d8c0e)

source3/smbd/dir.c

index 3a7b697d7580083d785757ca70539ed376939426..40b198ed72c42ced0fff9594187484c1c08d24d1 100644 (file)
@@ -729,10 +729,22 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
   dirp->pos = dirp->numentries = dirp->mallocsize = 0;
   dirp->data = dirp->current = NULL;
 
-  while ((n = vfs_readdirname(conn, p)))
+  while (True)
   {
     int l;
 
+    if (used == 0) {
+       n = ".";
+    } else if (used == 2) {
+       n = "..";
+    } else {
+       n = vfs_readdirname(conn, p);
+       if (n == NULL)
+               break;
+       if ((strcmp(".",n) == 0) ||(strcmp("..",n) == 0))
+               continue;
+    }
+
     l = strlen(n)+1;
 
     /* If it's a vetoed file, pretend it doesn't even exist */