diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-10-04 04:48:17 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-10-04 04:48:17 +0000 |
commit | 60a683465647932f7241ba9f92443d5e5294e20b (patch) | |
tree | e2164f85c3dc5232d9d727607064875759dd95fd /source/smbwrapper/smbw_dir.c | |
parent | 04e92e692e49234df6fbbfd07a33b315ed62f0de (diff) | |
download | samba-60a683465647932f7241ba9f92443d5e5294e20b.tar.gz |
use dummy file descriptors opened on /dev/null to ensure that the smbw
file descriptor allocation order is identical to the kernels.
Diffstat (limited to 'source/smbwrapper/smbw_dir.c')
-rw-r--r-- | source/smbwrapper/smbw_dir.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/smbwrapper/smbw_dir.c b/source/smbwrapper/smbw_dir.c index 22da76eb17c..c437a53e1f5 100644 --- a/source/smbwrapper/smbw_dir.c +++ b/source/smbwrapper/smbw_dir.c @@ -175,17 +175,23 @@ int smbw_dir_open(const char *fname) cur_dir = NULL; - fd = bitmap_find(smbw_file_bmap, 0); + fd = open("/dev/null", O_WRONLY); if (fd == -1) { errno = EMFILE; goto failed; } + if (bitmap_query(smbw_file_bmap, fd)) { + DEBUG(0,("ERROR: fd used in smbw_dir_open\n")); + errno = EIO; + goto failed; + } + DLIST_ADD(smbw_dirs, dir); bitmap_set(smbw_file_bmap, fd); - dir->fd = fd + SMBW_FD_OFFSET; + dir->fd = fd; dir->srv = srv; dir->path = strdup(s); @@ -241,7 +247,8 @@ int smbw_dir_close(int fd) return -1; } - bitmap_clear(smbw_file_bmap, dir->fd - SMBW_FD_OFFSET); + bitmap_clear(smbw_file_bmap, dir->fd); + close(dir->fd); DLIST_REMOVE(smbw_dirs, dir); |