summaryrefslogtreecommitdiffstats
path: root/source/smbd/dir.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-05-05 11:23:23 +0000
committerAndrew Tridgell <tridge@samba.org>1996-05-05 11:23:23 +0000
commit4b2579daae0a9d78780476694fd395d97445e197 (patch)
tree14080a99cdba708c7f443450293ad9167fa71105 /source/smbd/dir.c
parent7d7bad70d3b6b37037ad96b34e17a927675cde11 (diff)
downloadsamba-4b2579daae0a9d78780476694fd395d97445e197.tar.gz
samba-4b2579daae0a9d78780476694fd395d97445e197.tar.xz
samba-4b2579daae0a9d78780476694fd395d97445e197.zip
handle being passed a dptr of -1 to mean "close all open dir handles".
Looks like OS/2 does this. It caused a core dump.
Diffstat (limited to 'source/smbd/dir.c')
-rw-r--r--source/smbd/dir.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/smbd/dir.c b/source/smbd/dir.c
index ac6f918b9da..214b28dad04 100644
--- a/source/smbd/dir.c
+++ b/source/smbd/dir.c
@@ -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) {