Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Weirdness in comm(1)



    Date:        Fri, 27 Nov 2009 22:06:36 +0100
    From:        Joerg Sonnenberger <joerg%britannica.bec.de@localhost>
    Message-ID:  <20091127210636.GA8938%britannica.bec.de@localhost>

  |     iter = *lineptr;
  |     for (;;) {
  |             eos = *lineptr + *len - 1;
  | 
  |             while (iter < eos) {
  |                     ch = getc_unlocked(fp);
  |                     if (ch == -1)
  |                             break;


Why getc_unlocked() - I see nothing in getline(3) (aka getdelim(3))
that indicates either that the function is not thread safe, nor that
the stream paramater must be locked before the call, but that's what
use of getc_unlocked() implies doesn't it?   I assume you just accidentally
omitted the flockfile() stuff that would be required to use it safely?

kre



Home | Main Index | Thread Index | Old Index