handle being passed a dptr of -1 to mean "close all open dir handles".
authorAndrew Tridgell <tridge@samba.org>
Sun, 5 May 1996 11:23:23 +0000 (11:23 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 5 May 1996 11:23:23 +0000 (11:23 +0000)
Looks like OS/2 does this. It caused a core dump.

source/smbd/dir.c

index ac6f918b9da31ca3024fb5bf95b60e079d1932d5..214b28dad04927e4fe0607d9f1035187b5cfd62f 100644 (file)
@@ -186,6 +186,19 @@ close a dptr
 ****************************************************************************/
 void dptr_close(int key)
 {
+  /* OS/2 seems to use -1 to indicate "close all directories" */
+  if (key == -1) {
+    int i;
+    for (i=0;i<NUMDIRPTRS;i++) 
+      dptr_close(i);
+    return;
+  }
+
+  if (key < 0 || key >= NUMDIRPTRS) {
+    DEBUG(3,("Invalid key %d given to dptr_close\n",key));
+    return;
+  }
+
   if (dirptrs[key].valid) {
     DEBUG(4,("closing dptr key %d\n",key));
     if (dirptrs[key].ptr) {