There, ngl_fwrite() call can return 0 or -1. If -1 is returned, done /= WordSize will result in done being 0.
Maybe all Write() wrappers should threat -1 as an error.
Going back into PipeTo, 0 can be returned from the above Write call:
piped_in -= piped_out;
total_piped += piped_out;
piped_in is never decreased, resulting in an infinite loop.
When copying a file via
nglPath::Copy
,nglIStream::PipeTo
is used:Let's see
nglFile::Write
:There,
ngl_fwrite()
call can return 0 or -1. If -1 is returned,done /= WordSize
will result indone
being 0. Maybe allWrite()
wrappers should threat -1 as an error.Going back into
PipeTo
, 0 can be returned from the aboveWrite
call:piped_in
is never decreased, resulting in an infinite loop.