diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-07-09 20:28:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-07-09 20:28:31 -0700 |
commit | 1d8d2214495fa29931948e08041cc8a1159fdd19 (patch) | |
tree | 3df6164837ace10957d5114bce8e1b95eb97c06b /txr.1 | |
parent | db663c43dee33d7473db7492222b99cdaf34c1ff (diff) | |
download | txr-1d8d2214495fa29931948e08041cc8a1159fdd19.tar.gz txr-1d8d2214495fa29931948e08041cc8a1159fdd19.tar.bz2 txr-1d8d2214495fa29931948e08041cc8a1159fdd19.zip |
Add missing closedir.
* sysif.c (opendir_free): Since d->dir may now be null, avoid
calling closedir on it in that situation. Also, set d->dir to
null after closedir.
(closedir_wrap): New static function.
(readdir_wrap): If the d->dir is null, safely treat that as a
directory entry not being available; do not pass a null DIR
pointer to readdir.
(sysif_init): Register intrinsic function closedir.
* txr.1: Documented, plus spelling error fix under readdir.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -62862,6 +62862,10 @@ If no more directory entries remain, then .code readdir returns .codn nil . +In this situation, the +.meta dir-handle +is also closed, as if by a call to +.codn closedir . Otherwise, the next available directory entry is returned as a structure object of type @@ -62869,7 +62873,7 @@ structure object of type The .code readdir -function intenally skips and does not report the +function internally skips and does not report the .str . (dot) and @@ -62891,6 +62895,37 @@ allocates a fresh .code dirent structure. +.coNP Function @ closedir +.synb +.mets (opendir << dir-handle ) +.syne +.desc +The +.code closedir +function terminates the directory traversal managed by +.metn dir-handle , +releasing its resources. + +If this has already been done before, +.code closedir +returns +.codn nil , +otherwise it returns +.codn t . + +Further +.code readdir +calls on the same +.meta dir-handle +return +.codn nil . + +Note: the +.code readdir +function implicitly closes +.meta dir-handle +when the handle indicates that no more directory entries remain to be traversed. + .SS* Unix Sockets On platforms where the underlying system interface is available, \*(TX provides |