Skip to content

Commit

Permalink
Throw error when reaching internal file descriptor limit
Browse files Browse the repository at this point in the history
and add corresponding notes to the documentation
  • Loading branch information
zickgraf committed Oct 21, 2022
1 parent 76a5b6d commit f3c177a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/streams.gd
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,10 @@ DeclareOperation( "InputTextString", [ IsString ] );
## handles windows-style line endings. This means it should <E>not</E> be used for
## binary data. The <Ref BookName="IO" Oper="IO_File" /> function from the <Package>IO</Package>
## package should be used to access binary data.
## <P/>
## Note: At most 256 files may be open for reading or writing at the same time.
## Use <Ref Oper="CloseStream"/> to close the input stream once you have finished
## reading from it.
## </Description>
## </ManSection>
## <#/GAPDoc>
Expand Down Expand Up @@ -751,6 +755,10 @@ DeclareOperation( "OutputTextString", [ IsList, IsBool ] );
## <C>OutputGzipFile</C> acts identically to <C>OutputTextFile</C>, except it compresses
## the output with gzip.
## <P/>
## Note: At most 256 files may be open for reading or writing at the same time.
## Use <Ref Oper="CloseStream"/> to close the output stream once you have finished
## writing to it.
## <P/>
## <Example><![CDATA[
## gap> # use a temporary directory
## gap> name := Filename( DirectoryTemporary(), "test" );;
Expand Down
1 change: 1 addition & 0 deletions src/sysfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ Int SyFopen(const Char * name, const Char * mode, BOOL transparent_compress)

if ( fid == ARRAY_SIZE(syBuf) ) {
HashUnlock(&syBuf);
ErrorReturnVoid("Too many open files (internal file descriptor limit reached)", 0, 0, "you can 'return;'");
return (Int)-1;
}

Expand Down

0 comments on commit f3c177a

Please sign in to comment.