Re: STDOUT_FILENO and STDERR_FILENO



On 20/05/2013 17:09, John Emmas wrote:

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 :-(


Actually, is there a bug here anyway? Here's what that section of code looks like currently....

// glib/gtestutils.c - line 2278
      for (total = 0; total < nread; total += nwrote)
        {
          do
            nwrote = write (echo_fd, buf + total, nread - total);
          while (nwrote == -1 && errno == EINTR);
          if (nwrote == -1)
            g_error ("write failed: %s", g_strerror (errno));
          total += nwrote;
        }

notice that 'total += nwrote' occurs twice during each loop iteration. Was that the intended behaviour?

John


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