Re: STDOUT_FILENO and STDERR_FILENO



On 20/05/2013 14:44, Erik van Pienbroek wrote:
So when there is no valid stdout/stderr the fileno call will return
either -1 or -2. When this value is passed as argument to a write call,
then the write call itself will fail with an 'invalid file descriptor',
but other than that there's shouldn't be any major issues with it.

Hmmm... there might be one.

A few lines further down, 'total' gets incremented like this:-

      total += nwrote;

So if nwrote == (-1) we'll probably get stuck in an endless loop :-(

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]